Skip to content

MyCoder Issue Comment Action #2

MyCoder Issue Comment Action

MyCoder Issue Comment Action #2

Workflow file for this run

name: MyCoder Issue Comment Action
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: write
pull-requests: write
env:
PNPM_VERSION: 10.2.1
jobs:
process-comment:
runs-on: ubuntu-latest
if: contains(github.event.comment.body, '/mycoder')
steps:
- name: Extract prompt from comment
id: extract-prompt
run: |
COMMENT="${{ github.event.comment.body }}"
if [[ "$COMMENT" =~ "/mycoder "(.+) ]]; then
PROMPT="${BASH_REMATCH[1]}"
elif [[ "$COMMENT" =~ "/mycoder" ]]; then
# If just /mycoder with no text after, use a default prompt
PROMPT="Please review this issue and suggest next steps."
else
echo "No valid /mycoder command found"
exit 1
fi
echo "prompt=$PROMPT" >> $GITHUB_OUTPUT
echo "comment_url=${{ github.event.comment.html_url }}" >> $GITHUB_OUTPUT
echo "comment_id=${{ github.event.comment.id }}" >> $GITHUB_OUTPUT
- name: Checkout repository
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- run: pnpm install -g mycoder
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
echo "Running MyCoder for issue #${{ github.event.issue.number }} with prompt: ${{ steps.extract-prompt.outputs.prompt }}"
mycoder --githubMode true --userPrompt false "On issue #${{ github.event.issue.number }} the user asked: '${{ steps.extract-prompt.outputs.prompt }}' in comment ${{ steps.extract-prompt.outputs.comment_url }}. Please address this request. If you create a PR or take actions outside the scope of this issue, please report back to the issue with a comment explaining what you did."