|
4 | 4 | issue_comment: |
5 | 5 | types: [created] |
6 | 6 |
|
| 7 | +# Top-level permissions apply to all jobs - this is the maximum allowed for GITHUB_TOKEN |
7 | 8 | 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 |
11 | 17 |
|
12 | 18 | env: |
13 | 19 | PNPM_VERSION: 10.2.1 |
14 | 20 |
|
15 | 21 | jobs: |
16 | 22 | process-comment: |
17 | 23 | 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)) |
19 | 28 | steps: |
20 | 29 | - name: Extract prompt from comment |
21 | 30 | id: extract-prompt |
|
34 | 43 | with: |
35 | 44 | node-version-file: .nvmrc |
36 | 45 |
|
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 |
38 | 61 |
|
39 | 62 | - env: |
40 | 63 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
0 commit comments