chore: bump insta from 1.46.3 to 1.47.1 #61
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
| # Generated by tend. Regenerate with: uvx tend init | |
| name: tend-mention | |
| on: | |
| issues: | |
| types: [edited] | |
| issue_comment: | |
| types: [created, edited] | |
| pull_request_review_comment: | |
| types: [created, edited] | |
| jobs: | |
| verify: | |
| if: | | |
| (github.event_name == 'issues' && | |
| contains(github.event.issue.body, '@prql-bot') && | |
| github.event.issue.user.login != 'prql-bot') || | |
| (github.event_name == 'issue_comment' && | |
| github.event.comment.user.login != 'prql-bot') || | |
| (github.event_name == 'pull_request_review_comment' && | |
| github.event.comment.user.login != 'prql-bot') | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| should_run: ${{ steps.check.outputs.should_run }} | |
| steps: | |
| - name: Verify bot engagement | |
| id: check | |
| run: | | |
| # Mentions always run | |
| if [ "$EVENT_NAME" = "issues" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if [ -n "$COMMENT_BODY" ] && printf '%s\n' "$COMMENT_BODY" | grep -qF '@prql-bot'; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Non-mention: check bot engagement | |
| if [ "$EVENT_NAME" = "issue_comment" ]; then | |
| ISSUE_NUMBER="$ISSUE_OR_PR_NUMBER" | |
| if [ -z "$PR_URL" ]; then | |
| if [ "$ISSUE_AUTHOR" = "prql-bot" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| if printf '%s\n' "$ISSUE_BODY" | grep -qF '@prql-bot'; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER/comments" \ | |
| --jq '[.[] | select(.user.login == "prql-bot")] | length') | |
| if [ "$BOT_COMMENTS" -gt "0" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| echo "should_run=false" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| PR_NUMBER="$ISSUE_NUMBER" | |
| else | |
| PR_NUMBER="$EVENT_PR_NUMBER" | |
| fi | |
| PR_AUTHOR=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json author --jq '.author.login') | |
| if [ "$PR_AUTHOR" = "prql-bot" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| BOT_REVIEWS=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \ | |
| --jq '[.[] | select(.user.login == "prql-bot")] | length') | |
| if [ "$BOT_REVIEWS" -gt "0" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \ | |
| --jq '[.[] | select(.user.login == "prql-bot")] | length') | |
| if [ "$BOT_COMMENTS" -gt "0" ]; then | |
| echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0 | |
| fi | |
| echo "should_run=false" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| COMMENT_BODY: ${{ github.event.comment.body }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_OR_PR_NUMBER: ${{ github.event.issue.number }} | |
| ISSUE_AUTHOR: ${{ github.event.issue.user.login }} | |
| PR_URL: ${{ github.event.issue.pull_request.url }} | |
| EVENT_PR_NUMBER: ${{ github.event.pull_request.number }} | |
| - name: React to mention | |
| if: | | |
| steps.check.outputs.should_run == 'true' | |
| && github.event.comment | |
| && contains(github.event.comment.body, '@prql-bot') | |
| run: | | |
| gh api "repos/$REPO/issues/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || \ | |
| gh api "repos/$REPO/pulls/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || true | |
| env: | |
| REPO: ${{ github.repository }} | |
| COMMENT_ID: ${{ github.event.comment.id }} | |
| GH_TOKEN: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }} | |
| handle: | |
| needs: verify | |
| if: needs.verify.outputs.should_run == 'true' | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| actions: read | |
| issues: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| token: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }} | |
| - name: Check out PR branch | |
| if: | | |
| (github.event_name == 'issue_comment' && github.event.issue.pull_request.url != '') || | |
| github.event_name == 'pull_request_review_comment' | |
| run: | | |
| PR_STATE=$(gh pr view "$PR_NUMBER" --json state --jq '.state') | |
| if [ "$PR_STATE" = "OPEN" ]; then | |
| gh pr checkout "$PR_NUMBER" | |
| else | |
| echo "::warning::PR is $PR_STATE — staying on default branch" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number }} | |
| - uses: ./.github/actions/tend-setup | |
| - uses: max-sixty/tend@v1 | |
| with: | |
| github_token: ${{ secrets.PRQL_BOT_GITHUB_TOKEN }} | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| bot_name: prql-bot | |
| prompt: >- | |
| ${{ github.event_name == 'issues' | |
| && format('An issue was updated with a mention of you ({0}). Read it and respond.', github.event.issue.html_url) | |
| || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@prql-bot') | |
| && format('You were mentioned in an inline review comment on PR #{0} ({1}, review comment ID {2}). Read the full PR context (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."` — do not create a new top-level comment.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository)) | |
| || (github.event_name == 'pull_request_review_comment' | |
| && format('A user left an inline review comment on a PR where you previously participated (PR #{0}, {1}, review comment ID {2}). Read the full context. Only respond if the comment is directed at you or requests changes. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."`.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository)) | |
| || (contains(github.event.comment.body, '@prql-bot') | |
| && format('You were mentioned in a comment ({0}). Read the full issue or PR (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push.', github.event.comment.html_url)) | |
| || format('A user commented on an issue/PR where you previously participated ({0}). Read the full context. Only respond if the comment is directed at you, asks a question you can help with, or requests changes you can make. A comment that responds to concerns you raised in a review is directed at you — briefly acknowledge that the concerns are resolved (or explain why they are not). If the conversation is between humans, exit silently.', github.event.comment.html_url) | |
| }} |