Skip to content

Commit 884fa4d

Browse files
committed
better gh auth, git username/email, expanded permissions
2 parents 160b292 + 84d73d1 commit 884fa4d

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

.github/workflows/issue-comment.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ on:
44
issue_comment:
55
types: [created]
66

7+
# Top-level permissions apply to all jobs - this is the maximum allowed for GITHUB_TOKEN
78
permissions:
8-
contents: write
9-
issues: write
10-
pull-requests: write
9+
contents: write # Required for checkout, commit, push
10+
issues: write # Required for issue comments
11+
pull-requests: write # Required for creating PRs
12+
discussions: write # Added for more interaction capabilities
13+
statuses: write # Added for creating commit statuses
14+
checks: write # Added for creating check runs
15+
actions: read # Added for inspecting workflow runs
16+
packages: read # Added in case you need to access GitHub packages
1117

1218
env:
1319
PNPM_VERSION: 10.2.1
1420

1521
jobs:
1622
process-comment:
1723
runs-on: ubuntu-latest
18-
if: contains(github.event.comment.body, '/mycoder')
24+
# Only run if comment contains '/mycoder' AND commenter is in AUTHORIZED_USERS list
25+
if: |
26+
contains(github.event.comment.body, '/mycoder') &&
27+
contains(format(',{0},', 'bhouston'), format(',{0},', github.event.comment.user.login))
1928
steps:
2029
- name: Extract prompt from comment
2130
id: extract-prompt
@@ -34,7 +43,21 @@ jobs:
3443
with:
3544
node-version-file: .nvmrc
3645

37-
- run: pnpm install -g mycoder
46+
- name: Configure Git
47+
run: |
48+
git config --global user.name "MyCoder (On behalf of ${{ github.event.comment.user.login }})"
49+
git config --global user.email "[email protected]"
50+
51+
- run:
52+
pnpm install -g mycoder
53+
54+
# Auth GitHub CLI with the token
55+
- name: Configure GitHub CLI
56+
run: |
57+
# First try with GITHUB_TOKEN
58+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
59+
# Verify auth status
60+
gh auth status
3861
3962
- env:
4063
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)