Skip to content

Commit 7f7a877

Browse files
committed
add mycoder Github Action.
1 parent c6f9c4f commit 7f7a877

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/issue-comment.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: MyCoder Issue Comment Action
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
# Top-level permissions apply to all jobs - this is the maximum allowed for GITHUB_TOKEN
8+
permissions:
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
17+
18+
env:
19+
PNPM_VERSION: 10.2.1
20+
21+
jobs:
22+
process-comment:
23+
runs-on: ubuntu-latest
24+
# Only run if comment contains '/mycoder' AND commenter is in AUTHORIZED_USERS list
25+
if: |
26+
contains(github.event.comment.body, '/mycoder') &&
27+
github.event.comment.user.login == 'bhouston'
28+
steps:
29+
- name: Extract prompt from comment
30+
id: extract-prompt
31+
run: |
32+
echo "comment_url=${{ github.event.comment.html_url }}" >> $GITHUB_OUTPUT
33+
echo "comment_id=${{ github.event.comment.id }}" >> $GITHUB_OUTPUT
34+
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
38+
- uses: pnpm/action-setup@v2
39+
with:
40+
version: ${{ env.PNPM_VERSION }}
41+
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version-file: .nvmrc
45+
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
61+
62+
- env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
65+
run: |
66+
echo "Running MyCoder for issue #${{ github.event.issue.number }} with prompt: ${{ steps.extract-prompt.outputs.prompt }}"
67+
mycoder --userWarning false --upgradeCheck false --githubMode true --userPrompt false "On issue #${{ github.event.issue.number }} in comment ${{ steps.extract-prompt.outputs.comment_url }} the user invoked the mycoder CLI via /mycoder. Can you try to do what they requested or if it is unclear, respond with a comment to that affect to encourage them to be more clear."

0 commit comments

Comments
 (0)