Allow editing the previous user message #3190
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| id-token: write # Required by claude-code-action for GitHub App token exchange. | |
| jobs: | |
| claude: | |
| runs-on: ubuntu-latest | |
| if: | | |
| (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && | |
| contains(github.event.comment.body, '@claude') && | |
| github.event.comment.user.login == 'matticbot' | |
| steps: | |
| # issue_comment payloads identify PR comments, but do not include the PR | |
| # head repo. Query the PR before allowing Claude to run on fork PRs. | |
| - name: Check PR origin | |
| id: pr-origin | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| ISSUE_PULL_REQUEST_URL: ${{ github.event.issue.pull_request.url }} | |
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
| REPOSITORY: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| if [ "$EVENT_NAME" = "issue_comment" ] && [ -z "$ISSUE_PULL_REQUEST_URL" ]; then | |
| echo "is_internal=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| pr_number="${PULL_REQUEST_NUMBER:-$ISSUE_NUMBER}" | |
| if ! head_repo="$(gh api "repos/${REPOSITORY}/pulls/${pr_number}" --jq '.head.repo.full_name')"; then | |
| echo "Unable to determine PR head repository for #${pr_number}; skipping Claude." | |
| echo "is_internal=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if [ "$head_repo" = "$REPOSITORY" ]; then | |
| echo "is_internal=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_internal=false" >> "$GITHUB_OUTPUT" | |
| echo "Skipping Claude for external PR from ${head_repo:-unknown}." | |
| fi | |
| - name: Checkout repository | |
| if: steps.pr-origin.outputs.is_internal == 'true' | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run Claude | |
| if: steps.pr-origin.outputs.is_internal == 'true' | |
| uses: anthropics/claude-code-action@769e3bdff9bb7ecfb51bad4c9cba23d6f5fc5ea5 # v1.0.163 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |