diff --git a/.github/workflows/archie.lock.yml b/.github/workflows/archie.lock.yml index 4c9ac7e0d9..d76b27166e 100644 --- a/.github/workflows/archie.lock.yml +++ b/.github/workflows/archie.lock.yml @@ -60,10 +60,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -96,20 +95,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: archie GH_AW_WORKFLOW_NAME: "Archie" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ“Š *Diagram rendered by [{workflow_name}]({run_url})*\",\"footerWorkflowRecompile\":\"\\u003e šŸ”§ *Workflow sync report by [{workflow_name}]({run_url}) for {repository}*\",\"footerWorkflowRecompileComment\":\"\\u003e šŸ”„ *Update from [{workflow_name}]({run_url}) for {repository}*\",\"runStarted\":\"šŸ“ Archie here! [{workflow_name}]({run_url}) is sketching the architecture on this {event_type}...\",\"runSuccess\":\"šŸŽØ Blueprint complete! [{workflow_name}]({run_url}) has visualized the connections. The architecture speaks for itself! āœ…\",\"runFailure\":\"šŸ“ Drafting interrupted! [{workflow_name}]({run_url}) {status}. The diagram remains incomplete...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1269,6 +1266,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1283,6 +1283,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/brave.lock.yml b/.github/workflows/brave.lock.yml index 02a03d049f..c6b8c3c977 100644 --- a/.github/workflows/brave.lock.yml +++ b/.github/workflows/brave.lock.yml @@ -52,10 +52,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -88,20 +87,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: brave GH_AW_WORKFLOW_NAME: "Brave Web Search Agent" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e 🦁 *Search results brought to you by [{workflow_name}]({run_url})*\",\"footerWorkflowRecompile\":\"\\u003e šŸ”„ *Maintenance report by [{workflow_name}]({run_url}) for {repository}*\",\"runStarted\":\"šŸ” Brave Search activated! [{workflow_name}]({run_url}) is venturing into the web on this {event_type}...\",\"runSuccess\":\"🦁 Mission accomplished! [{workflow_name}]({run_url}) has returned with the findings. Knowledge acquired! šŸ†\",\"runFailure\":\"šŸ” Search interrupted! [{workflow_name}]({run_url}) {status}. The web remains unexplored...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1168,6 +1165,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1182,6 +1182,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/campaign-generator.lock.yml b/.github/workflows/campaign-generator.lock.yml index 8994565ea5..661ac36cb2 100644 --- a/.github/workflows/campaign-generator.lock.yml +++ b/.github/workflows/campaign-generator.lock.yml @@ -51,11 +51,10 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} issue_locked: ${{ steps.lock-issue.outputs.locked }} - reaction_id: ${{ steps.react.outputs.reaction-id }} steps: - name: Checkout actions folder uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 @@ -77,12 +76,11 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" GH_AW_WORKFLOW_NAME: "Campaign Generator" GH_AW_LOCK_FOR_AGENT: "true" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸŽÆ *Campaign coordination by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸš€ Campaign Generator starting! [{workflow_name}]({run_url}) is processing your campaign request for this {event_type}...\",\"runSuccess\":\"āœ… Campaign setup complete! [{workflow_name}]({run_url}) has successfully coordinated your campaign creation. Your project is ready! šŸ“Š\",\"runFailure\":\"āš ļø Campaign setup interrupted! [{workflow_name}]({run_url}) {status}. Please check the details and try again...\"}" @@ -90,7 +88,7 @@ jobs: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); - name: Lock issue for agent workflow id: lock-issue @@ -1732,6 +1730,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1745,6 +1746,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/changeset.lock.yml b/.github/workflows/changeset.lock.yml index 3275ec844a..5c132864a1 100644 --- a/.github/workflows/changeset.lock.yml +++ b/.github/workflows/changeset.lock.yml @@ -60,10 +60,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} text: ${{ steps.compute-text.outputs.text }} steps: - name: Checkout actions folder @@ -95,18 +94,17 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add rocket reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "rocket" GH_AW_WORKFLOW_NAME: "Changeset Generator" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1310,6 +1308,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1323,6 +1324,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add rocket reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "rocket" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/cloclo.lock.yml b/.github/workflows/cloclo.lock.yml index 3559733532..06abf0f247 100644 --- a/.github/workflows/cloclo.lock.yml +++ b/.github/workflows/cloclo.lock.yml @@ -86,10 +86,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -122,20 +121,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: cloclo GH_AW_WORKFLOW_NAME: "/cloclo" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸŽ¤ *Magnifique! Performance by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸŽµ Comme d'habitude! [{workflow_name}]({run_url}) takes the stage on this {event_type}...\",\"runSuccess\":\"šŸŽ¤ Bravo! [{workflow_name}]({run_url}) has delivered a stunning performance! Standing ovation! 🌟\",\"runFailure\":\"šŸŽµ Intermission... [{workflow_name}]({run_url}) {status}. The show must go on... eventually!\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1614,6 +1611,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1628,6 +1628,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/craft.lock.yml b/.github/workflows/craft.lock.yml index c89b847431..6af1b191ec 100644 --- a/.github/workflows/craft.lock.yml +++ b/.github/workflows/craft.lock.yml @@ -48,10 +48,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -84,20 +83,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: craft GH_AW_WORKFLOW_NAME: "Workflow Craft Agent" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e āš’ļø *Crafted with care by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ› ļø Master Crafter at work! [{workflow_name}]({run_url}) is forging a new workflow on this {event_type}...\",\"runSuccess\":\"āš’ļø Masterpiece complete! [{workflow_name}]({run_url}) has crafted your workflow. May it serve you well! šŸŽ–ļø\",\"runFailure\":\"šŸ› ļø Forge cooling down! [{workflow_name}]({run_url}) {status}. The anvil awaits another attempt...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1339,6 +1336,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1353,6 +1353,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/grumpy-reviewer.lock.yml b/.github/workflows/grumpy-reviewer.lock.yml index 2c77de0dd0..89192b2a4d 100644 --- a/.github/workflows/grumpy-reviewer.lock.yml +++ b/.github/workflows/grumpy-reviewer.lock.yml @@ -53,10 +53,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -89,20 +88,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: grumpy GH_AW_WORKFLOW_NAME: "Grumpy Code Reviewer šŸ”„" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e 😤 *Reluctantly reviewed by [{workflow_name}]({run_url})*\",\"runStarted\":\"😤 *sigh* [{workflow_name}]({run_url}) is begrudgingly looking at this {event_type}... This better be worth my time.\",\"runSuccess\":\"😤 Fine. [{workflow_name}]({run_url}) finished the review. It wasn't completely terrible. I guess. šŸ™„\",\"runFailure\":\"😤 Great. [{workflow_name}]({run_url}) {status}. As if my day couldn't get any worse...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1286,6 +1283,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1300,6 +1300,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/issue-classifier.lock.yml b/.github/workflows/issue-classifier.lock.yml index a554de1b73..14745feb8e 100644 --- a/.github/workflows/issue-classifier.lock.yml +++ b/.github/workflows/issue-classifier.lock.yml @@ -49,10 +49,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} text: ${{ steps.compute-text.outputs.text }} steps: - name: Checkout actions folder @@ -84,18 +83,17 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" GH_AW_WORKFLOW_NAME: "Issue Classifier" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -963,6 +961,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -976,6 +977,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/mergefest.lock.yml b/.github/workflows/mergefest.lock.yml index 511f9170bf..1302028e8c 100644 --- a/.github/workflows/mergefest.lock.yml +++ b/.github/workflows/mergefest.lock.yml @@ -48,10 +48,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} steps: - name: Checkout actions folder @@ -74,19 +73,17 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: mergefest GH_AW_WORKFLOW_NAME: "Mergefest" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1374,6 +1371,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1388,6 +1388,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index fde25d0706..757f849e34 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -70,10 +70,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -106,20 +105,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: summarize GH_AW_WORKFLOW_NAME: "Resource Summarizer Agent" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ“„ *Summary compiled by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ“– Page by page! [{workflow_name}]({run_url}) is reading through this {event_type}...\",\"runSuccess\":\"šŸ“š TL;DR ready! [{workflow_name}]({run_url}) has distilled the essence. Knowledge condensed! ✨\",\"runFailure\":\"šŸ“– Reading interrupted! [{workflow_name}]({run_url}) {status}. The document remains unsummarized...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1276,6 +1273,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1290,6 +1290,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index 45524964d9..82c4533965 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -52,10 +52,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -88,19 +87,17 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: plan GH_AW_WORKFLOW_NAME: "Plan Command" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1314,6 +1311,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1328,6 +1328,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index 43a52d7b77..f059368dce 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -55,10 +55,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -91,20 +90,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: poem-bot GH_AW_WORKFLOW_NAME: "Poem Bot - A Creative Agentic Workflow" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e 🪶 *Verses penned by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸŽ­ Hear ye! The muse stirs! [{workflow_name}]({run_url}) takes quill in hand for this {event_type}...\",\"runSuccess\":\"🪶 The poem is writ! [{workflow_name}]({run_url}) has composed verses most fair. Applause! šŸ‘\",\"runFailure\":\"šŸŽ­ Alas! [{workflow_name}]({run_url}) {status}. The muse has fled, leaving verses unsung...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1689,6 +1686,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1703,6 +1703,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/pr-nitpick-reviewer.lock.yml b/.github/workflows/pr-nitpick-reviewer.lock.yml index c9430defeb..8a2ddd0ce3 100644 --- a/.github/workflows/pr-nitpick-reviewer.lock.yml +++ b/.github/workflows/pr-nitpick-reviewer.lock.yml @@ -80,10 +80,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} steps: - name: Checkout actions folder @@ -106,20 +105,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: nit GH_AW_WORKFLOW_NAME: "PR Nitpick Reviewer šŸ”" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ” *Meticulously inspected by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ”¬ Adjusting monocle... [{workflow_name}]({run_url}) is scrutinizing every pixel of this {event_type}...\",\"runSuccess\":\"šŸ” Nitpicks catalogued! [{workflow_name}]({run_url}) has documented all the tiny details. Perfection awaits! āœ…\",\"runFailure\":\"šŸ”¬ Lens cracked! [{workflow_name}]({run_url}) {status}. Some nitpicks remain undetected...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1607,6 +1604,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1621,6 +1621,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index 6696e60421..9954785360 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -81,10 +81,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -117,20 +116,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add rocket reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "rocket" - GH_AW_COMMAND: q GH_AW_WORKFLOW_NAME: "Q" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸŽ© *Equipped by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ”§ Pay attention, 007! [{workflow_name}]({run_url}) is preparing your gadgets for this {event_type}...\",\"runSuccess\":\"šŸŽ© Mission equipment ready! [{workflow_name}]({run_url}) has optimized your workflow. Use wisely, 007! šŸ”«\",\"runFailure\":\"šŸ”§ Technical difficulties! [{workflow_name}]({run_url}) {status}. Even Q Branch has bad days...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1623,6 +1620,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1637,6 +1637,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add rocket reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "rocket" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/scout.lock.yml b/.github/workflows/scout.lock.yml index 194a732d53..68d4458efe 100644 --- a/.github/workflows/scout.lock.yml +++ b/.github/workflows/scout.lock.yml @@ -96,10 +96,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} text: ${{ steps.compute-text.outputs.text }} steps: @@ -132,20 +131,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/compute_text.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: scout GH_AW_WORKFLOW_NAME: "Scout" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ”­ *Intelligence gathered by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ•ļø Scout on patrol! [{workflow_name}]({run_url}) is blazing trails through this {event_type}...\",\"runSuccess\":\"šŸ”­ Recon complete! [{workflow_name}]({run_url}) has charted the territory. Map ready! šŸ—ŗļø\",\"runFailure\":\"šŸ•ļø Lost in the wilderness! [{workflow_name}]({run_url}) {status}. Sending search party...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1528,6 +1525,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1542,6 +1542,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 4e486813e5..fc9bde24f9 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -59,10 +59,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} steps: - name: Checkout actions folder uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 @@ -84,19 +83,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add heart reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "heart" GH_AW_WORKFLOW_NAME: "Smoke Claude" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ’„ *[THE END] — Illustrated by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ’„ **WHOOSH!** [{workflow_name}]({run_url}) springs into action on this {event_type}! *[Panel 1 begins...]*\",\"runSuccess\":\"šŸŽ¬ **THE END** — [{workflow_name}]({run_url}) **MISSION: ACCOMPLISHED!** The hero saves the day! ✨\",\"runFailure\":\"šŸ’« **TO BE CONTINUED...** [{workflow_name}]({run_url}) {status}! Our hero faces unexpected challenges...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1568,6 +1566,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1581,6 +1582,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add heart reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "heart" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/smoke-codex.lock.yml b/.github/workflows/smoke-codex.lock.yml index a3c0afe266..4718af20bc 100644 --- a/.github/workflows/smoke-codex.lock.yml +++ b/.github/workflows/smoke-codex.lock.yml @@ -58,10 +58,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} steps: - name: Checkout actions folder uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 @@ -83,19 +82,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add hooray reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "hooray" GH_AW_WORKFLOW_NAME: "Smoke Codex" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ”® *The oracle has spoken through [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ”® The ancient spirits stir... [{workflow_name}]({run_url}) awakens to divine this {event_type}...\",\"runSuccess\":\"✨ The prophecy is fulfilled... [{workflow_name}]({run_url}) has completed its mystical journey. The stars align. 🌟\",\"runFailure\":\"šŸŒ‘ The shadows whisper... [{workflow_name}]({run_url}) {status}. The oracle requires further meditation...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1435,6 +1433,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1448,6 +1449,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add hooray reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "hooray" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index 9fc84a4d1d..2d50783fab 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -53,10 +53,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} steps: - name: Checkout actions folder uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 @@ -78,19 +77,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" GH_AW_WORKFLOW_NAME: "Smoke Copilot" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ“° *BREAKING: Report filed by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ“° BREAKING: [{workflow_name}]({run_url}) is now investigating this {event_type}. Sources say the story is developing...\",\"runSuccess\":\"šŸ“° VERDICT: [{workflow_name}]({run_url}) has concluded. All systems operational. This is a developing story. šŸŽ¤\",\"runFailure\":\"šŸ“° DEVELOPING STORY: [{workflow_name}]({run_url}) reports {status}. Our correspondents are investigating the incident...\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1241,6 +1239,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1254,6 +1255,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/tidy.lock.yml b/.github/workflows/tidy.lock.yml index 1ec154a095..9773165c51 100644 --- a/.github/workflows/tidy.lock.yml +++ b/.github/workflows/tidy.lock.yml @@ -60,10 +60,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} steps: - name: Checkout actions folder @@ -86,19 +85,17 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: tidy GH_AW_WORKFLOW_NAME: "Tidy" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1205,6 +1202,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1219,6 +1219,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index 73e7152037..ab550c47d8 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -56,10 +56,9 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} - reaction_id: ${{ steps.react.outputs.reaction-id }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} slash_command: ${{ needs.pre_activation.outputs.matched_command }} steps: - name: Checkout actions folder @@ -82,20 +81,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" - GH_AW_COMMAND: unbloat GH_AW_WORKFLOW_NAME: "Documentation Unbloat" GH_AW_SAFE_OUTPUT_MESSAGES: "{\"footer\":\"\\u003e šŸ—œļø *Compressed by [{workflow_name}]({run_url})*\",\"runStarted\":\"šŸ“¦ Time to slim down! [{workflow_name}]({run_url}) is trimming the excess from this {event_type}...\",\"runSuccess\":\"šŸ—œļø Docs on a diet! [{workflow_name}]({run_url}) has removed the bloat. Lean and mean! šŸ’Ŗ\",\"runFailure\":\"šŸ“¦ Unbloating paused! [{workflow_name}]({run_url}) {status}. The docs remain... fluffy.\"}" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); agent: @@ -1579,6 +1576,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_command_position.outputs.command_position_ok == 'true') }} matched_command: ${{ steps.check_command_position.outputs.matched_command }} @@ -1593,6 +1593,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for command workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/.github/workflows/workflow-generator.lock.yml b/.github/workflows/workflow-generator.lock.yml index 087fc36f6f..affa182a17 100644 --- a/.github/workflows/workflow-generator.lock.yml +++ b/.github/workflows/workflow-generator.lock.yml @@ -46,11 +46,10 @@ jobs: issues: write pull-requests: write outputs: - comment_id: ${{ steps.react.outputs.comment-id }} - comment_repo: ${{ steps.react.outputs.comment-repo }} - comment_url: ${{ steps.react.outputs.comment-url }} + comment_id: ${{ steps.add-comment.outputs.comment-id }} + comment_repo: ${{ steps.add-comment.outputs.comment-repo }} + comment_url: ${{ steps.add-comment.outputs.comment-url }} issue_locked: ${{ steps.lock-issue.outputs.locked }} - reaction_id: ${{ steps.react.outputs.reaction-id }} steps: - name: Checkout actions folder uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 @@ -72,19 +71,18 @@ jobs: setupGlobals(core, github, context, exec, io); const { main } = require('/opt/gh-aw/actions/check_workflow_timestamp_api.cjs'); await main(); - - name: Add eyes reaction to the triggering item - id: react + - name: Add comment with workflow run link + id: add-comment if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: - GH_AW_REACTION: "eyes" GH_AW_WORKFLOW_NAME: "Workflow Generator" GH_AW_LOCK_FOR_AGENT: "true" with: script: | const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); setupGlobals(core, github, context, exec, io); - const { main } = require('/opt/gh-aw/actions/add_reaction_and_edit_comment.cjs'); + const { main } = require('/opt/gh-aw/actions/add_workflow_run_comment.cjs'); await main(); - name: Lock issue for agent workflow id: lock-issue @@ -1180,6 +1178,9 @@ jobs: runs-on: ubuntu-slim permissions: contents: read + discussions: write + issues: write + pull-requests: write outputs: activated: ${{ steps.check_membership.outputs.is_team_member == 'true' }} steps: @@ -1193,6 +1194,18 @@ jobs: uses: ./actions/setup with: destination: /opt/gh-aw/actions + - name: Add eyes reaction for immediate feedback + id: react + if: github.event_name == 'issues' || github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment' || github.event_name == 'discussion' || github.event_name == 'discussion_comment' || (github.event_name == 'pull_request') && (github.event.pull_request.head.repo.id == github.repository_id) + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_REACTION: "eyes" + with: + script: | + const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/opt/gh-aw/actions/add_reaction.cjs'); + await main(); - name: Check team membership for workflow id: check_membership uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/actions/setup/js/add_reaction.cjs b/actions/setup/js/add_reaction.cjs new file mode 100644 index 0000000000..ae34085b1c --- /dev/null +++ b/actions/setup/js/add_reaction.cjs @@ -0,0 +1,200 @@ +// @ts-check +/// + +const { getErrorMessage } = require("./error_helpers.cjs"); + +/** + * Add a reaction to the triggering item (issue, PR, comment, or discussion). + * This provides immediate feedback to the user when a workflow is triggered. + * This script only adds reactions - it does NOT create comments. + * Use add_reaction_and_edit_comment.cjs in the activation job to create the comment with workflow link. + */ +async function main() { + // Read inputs from environment variables + const reaction = process.env.GH_AW_REACTION || "eyes"; + + core.info(`Adding reaction: ${reaction}`); + + // Validate reaction type + const validReactions = ["+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"]; + if (!validReactions.includes(reaction)) { + core.setFailed(`Invalid reaction type: ${reaction}. Valid reactions are: ${validReactions.join(", ")}`); + return; + } + + // Determine the API endpoint based on the event type + let reactionEndpoint; + const eventName = context.eventName; + const owner = context.repo.owner; + const repo = context.repo.repo; + + try { + switch (eventName) { + case "issues": + const issueNumber = context.payload?.issue?.number; + if (!issueNumber) { + core.setFailed("Issue number not found in event payload"); + return; + } + reactionEndpoint = `/repos/${owner}/${repo}/issues/${issueNumber}/reactions`; + break; + + case "issue_comment": + const commentId = context.payload?.comment?.id; + if (!commentId) { + core.setFailed("Comment ID not found in event payload"); + return; + } + reactionEndpoint = `/repos/${owner}/${repo}/issues/comments/${commentId}/reactions`; + break; + + case "pull_request": + const prNumber = context.payload?.pull_request?.number; + if (!prNumber) { + core.setFailed("Pull request number not found in event payload"); + return; + } + // PRs are "issues" for the reactions endpoint + reactionEndpoint = `/repos/${owner}/${repo}/issues/${prNumber}/reactions`; + break; + + case "pull_request_review_comment": + const reviewCommentId = context.payload?.comment?.id; + if (!reviewCommentId) { + core.setFailed("Review comment ID not found in event payload"); + return; + } + reactionEndpoint = `/repos/${owner}/${repo}/pulls/comments/${reviewCommentId}/reactions`; + break; + + case "discussion": + const discussionNumber = context.payload?.discussion?.number; + if (!discussionNumber) { + core.setFailed("Discussion number not found in event payload"); + return; + } + // Discussions use GraphQL API - get the node ID + const discussion = await getDiscussionId(owner, repo, discussionNumber); + await addDiscussionReaction(discussion.id, reaction); + return; // Early return for discussion events + + case "discussion_comment": + const commentNodeId = context.payload?.comment?.node_id; + if (!commentNodeId) { + core.setFailed("Discussion comment node ID not found in event payload"); + return; + } + await addDiscussionReaction(commentNodeId, reaction); + return; // Early return for discussion comment events + + default: + core.setFailed(`Unsupported event type: ${eventName}`); + return; + } + + // Add reaction using REST API (for non-discussion events) + core.info(`Adding reaction to: ${reactionEndpoint}`); + await addReaction(reactionEndpoint, reaction); + } catch (error) { + const errorMessage = getErrorMessage(error); + core.error(`Failed to add reaction: ${errorMessage}`); + core.setFailed(`Failed to add reaction: ${errorMessage}`); + } +} + +/** + * Add a reaction to a GitHub issue, PR, or comment using REST API + * @param {string} endpoint - The GitHub API endpoint to add the reaction to + * @param {string} reaction - The reaction type to add + */ +async function addReaction(endpoint, reaction) { + const response = await github.request("POST " + endpoint, { + content: reaction, + headers: { + Accept: "application/vnd.github+json", + }, + }); + + const reactionId = response.data?.id; + if (reactionId) { + core.info(`Successfully added reaction: ${reaction} (id: ${reactionId})`); + core.setOutput("reaction-id", reactionId.toString()); + } else { + core.info(`Successfully added reaction: ${reaction}`); + core.setOutput("reaction-id", ""); + } +} + +/** + * Add a reaction to a GitHub discussion or discussion comment using GraphQL + * @param {string} subjectId - The node ID of the discussion or comment + * @param {string} reaction - The reaction type to add (mapped to GitHub's ReactionContent enum) + */ +async function addDiscussionReaction(subjectId, reaction) { + // Map reaction names to GitHub's GraphQL ReactionContent enum + const reactionMap = { + "+1": "THUMBS_UP", + "-1": "THUMBS_DOWN", + laugh: "LAUGH", + confused: "CONFUSED", + heart: "HEART", + hooray: "HOORAY", + rocket: "ROCKET", + eyes: "EYES", + }; + + const reactionContent = reactionMap[reaction]; + if (!reactionContent) { + throw new Error(`Invalid reaction type for GraphQL: ${reaction}`); + } + + const result = await github.graphql( + ` + mutation($subjectId: ID!, $content: ReactionContent!) { + addReaction(input: { subjectId: $subjectId, content: $content }) { + reaction { + id + content + } + } + }`, + { subjectId, content: reactionContent } + ); + + const reactionId = result.addReaction.reaction.id; + core.info(`Successfully added reaction: ${reaction} (id: ${reactionId})`); + core.setOutput("reaction-id", reactionId); +} + +/** + * Get the node ID for a discussion + * @param {string} owner - Repository owner + * @param {string} repo - Repository name + * @param {number} discussionNumber - Discussion number + * @returns {Promise<{id: string, url: string}>} Discussion details + */ +async function getDiscussionId(owner, repo, discussionNumber) { + const { repository } = await github.graphql( + ` + query($owner: String!, $repo: String!, $num: Int!) { + repository(owner: $owner, name: $repo) { + discussion(number: $num) { + id + url + } + } + }`, + { owner, repo, num: discussionNumber } + ); + + if (!repository || !repository.discussion) { + throw new Error(`Discussion #${discussionNumber} not found in ${owner}/${repo}`); + } + + return { + id: repository.discussion.id, + url: repository.discussion.url, + }; +} + +module.exports = { main }; diff --git a/actions/setup/js/add_workflow_run_comment.cjs b/actions/setup/js/add_workflow_run_comment.cjs new file mode 100644 index 0000000000..6a1aa023f4 --- /dev/null +++ b/actions/setup/js/add_workflow_run_comment.cjs @@ -0,0 +1,273 @@ +// @ts-check +/// + +const { getRunStartedMessage } = require("./messages_run_status.cjs"); +const { getErrorMessage } = require("./error_helpers.cjs"); + +/** + * Add a comment with a workflow run link to the triggering item. + * This script ONLY creates comments - it does NOT add reactions. + * Use add_reaction.cjs in the pre-activation job to add reactions first for immediate feedback. + */ +async function main() { + const runId = context.runId; + const githubServer = process.env.GITHUB_SERVER_URL || "https://github.com"; + const runUrl = context.payload.repository ? `${context.payload.repository.html_url}/actions/runs/${runId}` : `${githubServer}/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`; + + core.info(`Run ID: ${runId}`); + core.info(`Run URL: ${runUrl}`); + + // Determine the API endpoint based on the event type + let commentEndpoint; + const eventName = context.eventName; + const owner = context.repo.owner; + const repo = context.repo.repo; + + try { + switch (eventName) { + case "issues": + const issueNumber = context.payload?.issue?.number; + if (!issueNumber) { + core.setFailed("Issue number not found in event payload"); + return; + } + commentEndpoint = `/repos/${owner}/${repo}/issues/${issueNumber}/comments`; + break; + + case "issue_comment": + const issueNumberForComment = context.payload?.issue?.number; + if (!issueNumberForComment) { + core.setFailed("Issue number not found in event payload"); + return; + } + // Create new comment on the issue itself, not on the comment + commentEndpoint = `/repos/${owner}/${repo}/issues/${issueNumberForComment}/comments`; + break; + + case "pull_request": + const prNumber = context.payload?.pull_request?.number; + if (!prNumber) { + core.setFailed("Pull request number not found in event payload"); + return; + } + commentEndpoint = `/repos/${owner}/${repo}/issues/${prNumber}/comments`; + break; + + case "pull_request_review_comment": + const prNumberForReviewComment = context.payload?.pull_request?.number; + if (!prNumberForReviewComment) { + core.setFailed("Pull request number not found in event payload"); + return; + } + // Create new comment on the PR itself (using issues endpoint since PRs are issues) + commentEndpoint = `/repos/${owner}/${repo}/issues/${prNumberForReviewComment}/comments`; + break; + + case "discussion": + const discussionNumber = context.payload?.discussion?.number; + if (!discussionNumber) { + core.setFailed("Discussion number not found in event payload"); + return; + } + commentEndpoint = `discussion:${discussionNumber}`; // Special format to indicate discussion + break; + + case "discussion_comment": + const discussionCommentNumber = context.payload?.discussion?.number; + const discussionCommentId = context.payload?.comment?.id; + if (!discussionCommentNumber || !discussionCommentId) { + core.setFailed("Discussion or comment information not found in event payload"); + return; + } + commentEndpoint = `discussion_comment:${discussionCommentNumber}:${discussionCommentId}`; // Special format + break; + + default: + core.setFailed(`Unsupported event type: ${eventName}`); + return; + } + + core.info(`Creating comment on: ${commentEndpoint}`); + await addCommentWithWorkflowLink(commentEndpoint, runUrl, eventName); + } catch (error) { + const errorMessage = getErrorMessage(error); + core.error(`Failed to create comment: ${errorMessage}`); + // Don't fail the job - just warn since this is not critical + core.warning(`Failed to create comment with workflow link: ${errorMessage}`); + } +} + +/** + * Add a comment with a workflow run link + * @param {string} endpoint - The GitHub API endpoint to create the comment (or special format for discussions) + * @param {string} runUrl - The URL of the workflow run + * @param {string} eventName - The event type (to determine the comment text) + */ +async function addCommentWithWorkflowLink(endpoint, runUrl, eventName) { + // Get workflow name from environment variable + const workflowName = process.env.GH_AW_WORKFLOW_NAME || "Workflow"; + + // Determine the event type description + let eventTypeDescription; + switch (eventName) { + case "issues": + eventTypeDescription = "issue"; + break; + case "pull_request": + eventTypeDescription = "pull request"; + break; + case "issue_comment": + eventTypeDescription = "issue comment"; + break; + case "pull_request_review_comment": + eventTypeDescription = "pull request review comment"; + break; + case "discussion": + eventTypeDescription = "discussion"; + break; + case "discussion_comment": + eventTypeDescription = "discussion comment"; + break; + default: + eventTypeDescription = "event"; + } + + // Use getRunStartedMessage for the workflow link text (supports custom messages) + const workflowLinkText = getRunStartedMessage({ + workflowName: workflowName, + runUrl: runUrl, + eventType: eventTypeDescription, + }); + + // Add workflow-id and tracker-id markers for hide-older-comments feature + const workflowId = process.env.GITHUB_WORKFLOW || ""; + const trackerId = process.env.GH_AW_TRACKER_ID || ""; + + let commentBody = workflowLinkText; + + // Add lock notice if lock-for-agent is enabled for issues or issue_comment + const lockForAgent = process.env.GH_AW_LOCK_FOR_AGENT === "true"; + if (lockForAgent && (eventName === "issues" || eventName === "issue_comment")) { + commentBody += "\n\nšŸ”’ This issue has been locked while the workflow is running to prevent concurrent modifications."; + } + + // Add workflow-id marker if available + if (workflowId) { + commentBody += `\n\n`; + } + + // Add tracker-id marker if available (for backwards compatibility) + if (trackerId) { + commentBody += `\n\n`; + } + + // Add comment type marker to identify this as a reaction comment + // This prevents it from being hidden by hide-older-comments + commentBody += `\n\n`; + + // Handle discussion events specially + if (eventName === "discussion") { + // Parse discussion number from special format: "discussion:NUMBER" + const discussionNumber = parseInt(endpoint.split(":")[1], 10); + + // Create a new comment on the discussion using GraphQL + const { repository } = await github.graphql( + ` + query($owner: String!, $repo: String!, $num: Int!) { + repository(owner: $owner, name: $repo) { + discussion(number: $num) { + id + } + } + }`, + { owner: context.repo.owner, repo: context.repo.repo, num: discussionNumber } + ); + + const discussionId = repository.discussion.id; + + const result = await github.graphql( + ` + mutation($dId: ID!, $body: String!) { + addDiscussionComment(input: { discussionId: $dId, body: $body }) { + comment { + id + url + } + } + }`, + { dId: discussionId, body: commentBody } + ); + + const comment = result.addDiscussionComment.comment; + core.info(`Successfully created discussion comment with workflow link`); + core.info(`Comment ID: ${comment.id}`); + core.info(`Comment URL: ${comment.url}`); + core.info(`Comment Repo: ${context.repo.owner}/${context.repo.repo}`); + core.setOutput("comment-id", comment.id); + core.setOutput("comment-url", comment.url); + core.setOutput("comment-repo", `${context.repo.owner}/${context.repo.repo}`); + return; + } else if (eventName === "discussion_comment") { + // Parse discussion number from special format: "discussion_comment:NUMBER:COMMENT_ID" + const discussionNumber = parseInt(endpoint.split(":")[1], 10); + + // Create a new comment on the discussion using GraphQL + const { repository } = await github.graphql( + ` + query($owner: String!, $repo: String!, $num: Int!) { + repository(owner: $owner, name: $repo) { + discussion(number: $num) { + id + } + } + }`, + { owner: context.repo.owner, repo: context.repo.repo, num: discussionNumber } + ); + + const discussionId = repository.discussion.id; + + // Get the comment node ID to use as the parent for threading + const commentNodeId = context.payload?.comment?.node_id; + + const result = await github.graphql( + ` + mutation($dId: ID!, $body: String!, $replyToId: ID!) { + addDiscussionComment(input: { discussionId: $dId, body: $body, replyToId: $replyToId }) { + comment { + id + url + } + } + }`, + { dId: discussionId, body: commentBody, replyToId: commentNodeId } + ); + + const comment = result.addDiscussionComment.comment; + core.info(`Successfully created discussion comment with workflow link`); + core.info(`Comment ID: ${comment.id}`); + core.info(`Comment URL: ${comment.url}`); + core.info(`Comment Repo: ${context.repo.owner}/${context.repo.repo}`); + core.setOutput("comment-id", comment.id); + core.setOutput("comment-url", comment.url); + core.setOutput("comment-repo", `${context.repo.owner}/${context.repo.repo}`); + return; + } + + // Create a new comment for non-discussion events + const createResponse = await github.request("POST " + endpoint, { + body: commentBody, + headers: { + Accept: "application/vnd.github+json", + }, + }); + + core.info(`Successfully created comment with workflow link`); + core.info(`Comment ID: ${createResponse.data.id}`); + core.info(`Comment URL: ${createResponse.data.html_url}`); + core.info(`Comment Repo: ${context.repo.owner}/${context.repo.repo}`); + core.setOutput("comment-id", createResponse.data.id.toString()); + core.setOutput("comment-url", createResponse.data.html_url); + core.setOutput("comment-repo", `${context.repo.owner}/${context.repo.repo}`); +} + +module.exports = { main }; diff --git a/pkg/workflow/compiler_activation_jobs.go b/pkg/workflow/compiler_activation_jobs.go index 966ed33451..31771124c6 100644 --- a/pkg/workflow/compiler_activation_jobs.go +++ b/pkg/workflow/compiler_activation_jobs.go @@ -37,12 +37,48 @@ func (c *Compiler) buildPreActivationJob(data *WorkflowData, needsPermissionChec steps = append(steps, c.generateSetupStep(setupActionRef, SetupActionDestination)...) - // Set permissions if checkout is needed (for local actions in dev mode) + // Determine permissions for pre-activation job + var perms *Permissions if needsContentsRead { - perms := NewPermissionsContentsRead() + perms = NewPermissionsContentsRead() + } + + // Add reaction permissions if reaction is configured (reactions added in pre-activation for immediate feedback) + if data.AIReaction != "" && data.AIReaction != "none" { + if perms == nil { + perms = NewPermissions() + } + // Add write permissions for reactions + perms.Set(PermissionIssues, PermissionWrite) + perms.Set(PermissionPullRequests, PermissionWrite) + perms.Set(PermissionDiscussions, PermissionWrite) + } + + // Set permissions if any were configured + if perms != nil { permissions = perms.RenderToYAML() } + // Add reaction step immediately after setup for instant user feedback + // This happens BEFORE any checks, so users see progress immediately + if data.AIReaction != "" && data.AIReaction != "none" { + reactionCondition := BuildReactionCondition() + + steps = append(steps, fmt.Sprintf(" - name: Add %s reaction for immediate feedback\n", data.AIReaction)) + steps = append(steps, " id: react\n") + steps = append(steps, fmt.Sprintf(" if: %s\n", reactionCondition.Render())) + steps = append(steps, fmt.Sprintf(" uses: %s\n", GetActionPin("actions/github-script"))) + + // Add environment variables + steps = append(steps, " env:\n") + // Quote the reaction value to prevent YAML interpreting +1/-1 as integers + steps = append(steps, fmt.Sprintf(" GH_AW_REACTION: %q\n", data.AIReaction)) + + steps = append(steps, " with:\n") + steps = append(steps, " script: |\n") + steps = append(steps, generateGitHubScriptWithRequire("add_reaction.cjs")) + } + // Add team member check if permission checks are needed if needsPermissionCheck { steps = c.generateMembershipCheck(data, steps) @@ -362,23 +398,18 @@ func (c *Compiler) buildActivationJob(data *WorkflowData, preActivationJobCreate outputs["text"] = "${{ steps.compute-text.outputs.text }}" } - // Add reaction step if ai-reaction is configured and not "none" + // Add comment with workflow run link if ai-reaction is configured and not "none" + // Note: The reaction was already added in the pre-activation job for immediate feedback if data.AIReaction != "" && data.AIReaction != "none" { reactionCondition := BuildReactionCondition() - steps = append(steps, fmt.Sprintf(" - name: Add %s reaction to the triggering item\n", data.AIReaction)) - steps = append(steps, " id: react\n") + steps = append(steps, " - name: Add comment with workflow run link\n") + steps = append(steps, " id: add-comment\n") steps = append(steps, fmt.Sprintf(" if: %s\n", reactionCondition.Render())) steps = append(steps, fmt.Sprintf(" uses: %s\n", GetActionPin("actions/github-script"))) // Add environment variables steps = append(steps, " env:\n") - // Quote the reaction value to prevent YAML interpreting +1/-1 as integers - steps = append(steps, fmt.Sprintf(" GH_AW_REACTION: %q\n", data.AIReaction)) - if len(data.Command) > 0 { - // Pass first command for backward compatibility with reaction script - steps = append(steps, fmt.Sprintf(" GH_AW_COMMAND: %s\n", data.Command[0])) - } steps = append(steps, fmt.Sprintf(" GH_AW_WORKFLOW_NAME: %q\n", data.Name)) // Add tracker-id if present @@ -403,13 +434,12 @@ func (c *Compiler) buildActivationJob(data *WorkflowData, preActivationJobCreate steps = append(steps, " with:\n") steps = append(steps, " script: |\n") - steps = append(steps, generateGitHubScriptWithRequire("add_reaction_and_edit_comment.cjs")) + steps = append(steps, generateGitHubScriptWithRequire("add_workflow_run_comment.cjs")) - // Add reaction outputs - outputs["reaction_id"] = "${{ steps.react.outputs.reaction-id }}" - outputs["comment_id"] = "${{ steps.react.outputs.comment-id }}" - outputs["comment_url"] = "${{ steps.react.outputs.comment-url }}" - outputs["comment_repo"] = "${{ steps.react.outputs.comment-repo }}" + // Add comment outputs (no reaction_id since reaction was added in pre-activation) + outputs["comment_id"] = "${{ steps.add-comment.outputs.comment-id }}" + outputs["comment_url"] = "${{ steps.add-comment.outputs.comment-url }}" + outputs["comment_repo"] = "${{ steps.add-comment.outputs.comment-repo }}" } // Add lock step if lock-for-agent is enabled diff --git a/pkg/workflow/compiler_jobs_test.go b/pkg/workflow/compiler_jobs_test.go index 631a5f470a..63e84b4ad5 100644 --- a/pkg/workflow/compiler_jobs_test.go +++ b/pkg/workflow/compiler_jobs_test.go @@ -167,18 +167,15 @@ func TestBuildActivationJobWithReaction(t *testing.T) { t.Fatalf("buildActivationJob() returned error: %v", err) } - // Check that outputs include reaction-related outputs - if _, ok := job.Outputs["reaction_id"]; !ok { - t.Error("Expected 'reaction_id' output") - } + // Check that outputs include comment-related outputs (but not reaction_id since reaction is in pre-activation) if _, ok := job.Outputs["comment_id"]; !ok { t.Error("Expected 'comment_id' output") } - // Check for reaction step + // Check for comment step (not reaction, since reaction moved to pre-activation) stepsContent := strings.Join(job.Steps, "") - if !strings.Contains(stepsContent, "rocket reaction") { - t.Error("Expected reaction step with 'rocket'") + if !strings.Contains(stepsContent, "Add comment with workflow run link") { + t.Error("Expected comment step in activation job") } } diff --git a/pkg/workflow/reaction_none_test.go b/pkg/workflow/reaction_none_test.go index 174f1a0e6b..04a63a30bb 100644 --- a/pkg/workflow/reaction_none_test.go +++ b/pkg/workflow/reaction_none_test.go @@ -159,25 +159,25 @@ Test command workflow with default (eyes) reaction. } compiled := string(compiledBytes) - // Verify that activation job HAS reaction step - if !strings.Contains(compiled, "Add eyes reaction to the triggering item") { - t.Error("Activation job should have reaction step when reaction defaults to 'eyes'") + // Verify that pre-activation job HAS reaction step (moved for immediate feedback) + if !strings.Contains(compiled, "Add eyes reaction for immediate feedback") { + t.Error("Pre-activation job should have reaction step when reaction defaults to 'eyes'") } - // Verify that activation job HAS reaction permissions - activationJobSection := extractJobSection(compiled, string(constants.ActivationJobName)) - if !strings.Contains(activationJobSection, "issues: write") { - t.Error("Activation job should have 'issues: write' permission when reaction is enabled") + // Verify that pre-activation job HAS reaction permissions + preActivationJobSection := extractJobSection(compiled, string(constants.PreActivationJobName)) + if !strings.Contains(preActivationJobSection, "issues: write") { + t.Error("Pre-activation job should have 'issues: write' permission when reaction is enabled") } - if !strings.Contains(activationJobSection, "pull-requests: write") { - t.Error("Activation job should have 'pull-requests: write' permission when reaction is enabled") + if !strings.Contains(preActivationJobSection, "pull-requests: write") { + t.Error("Pre-activation job should have 'pull-requests: write' permission when reaction is enabled") } - if !strings.Contains(activationJobSection, "discussions: write") { - t.Error("Activation job should have 'discussions: write' permission when reaction is enabled") + if !strings.Contains(preActivationJobSection, "discussions: write") { + t.Error("Pre-activation job should have 'discussions: write' permission when reaction is enabled") } - // Verify that activation job also has contents: read permission for checkout - if !strings.Contains(activationJobSection, "contents: read") { + // Verify that pre-activation job also has contents: read permission for checkout + if !strings.Contains(preActivationJobSection, "contents: read") { t.Error("Activation job should have 'contents: read' permission for checkout step") } @@ -243,9 +243,9 @@ Test command workflow with explicit rocket reaction. } compiled := string(compiledBytes) - // Verify that activation job HAS rocket reaction step - if !strings.Contains(compiled, "Add rocket reaction to the triggering item") { - t.Error("Activation job should have rocket reaction step") + // Verify that pre-activation job HAS rocket reaction step (moved for immediate feedback) + if !strings.Contains(compiled, "Add rocket reaction for immediate feedback") { + t.Error("Pre-activation job should have rocket reaction step") } // Verify that conclusion job IS created @@ -325,15 +325,15 @@ Test workflow triggered by issue template with "eyes" reaction. } compiled := string(compiledBytes) - // Verify that activation job HAS eyes reaction step - if !strings.Contains(compiled, "Add eyes reaction to the triggering item") { - t.Error("Activation job should have eyes reaction step for issue template workflow") + // Verify that pre-activation job HAS eyes reaction step (moved for immediate feedback) + if !strings.Contains(compiled, "Add eyes reaction for immediate feedback") { + t.Error("Pre-activation job should have eyes reaction step for issue template workflow") } - // Verify that activation job HAS reaction permissions - activationJobSection := extractJobSection(compiled, string(constants.ActivationJobName)) - if !strings.Contains(activationJobSection, "issues: write") { - t.Error("Activation job should have 'issues: write' permission when reaction is enabled") + // Verify that pre-activation job HAS reaction permissions + preActivationJobSection := extractJobSection(compiled, string(constants.PreActivationJobName)) + if !strings.Contains(preActivationJobSection, "issues: write") { + t.Error("Pre-activation job should have 'issues: write' permission when reaction is enabled") } // Verify that lock issue step is present (due to lock-for-agent: true) diff --git a/pkg/workflow/reaction_outputs_test.go b/pkg/workflow/reaction_outputs_test.go index 706722beaa..dbd6fb4c8f 100644 --- a/pkg/workflow/reaction_outputs_test.go +++ b/pkg/workflow/reaction_outputs_test.go @@ -57,8 +57,8 @@ This workflow should generate add_reaction job with comment outputs. } // Check for reaction job outputs + // Verify that comment-related outputs are present (reaction_id is no longer in activation) expectedOutputs := []string{ - "reaction_id:", "comment_id:", "comment_url:", "comment_repo:", @@ -70,23 +70,20 @@ This workflow should generate add_reaction job with comment outputs. } } - // Verify the outputs reference the react step - now in activation job - if !strings.Contains(yamlContent, "steps.react.outputs.reaction-id") { - t.Error("Generated YAML should contain reaction-id output reference") - } - if !strings.Contains(yamlContent, "steps.react.outputs.comment-id") { + // Verify the outputs reference the add-comment step in activation job + if !strings.Contains(yamlContent, "steps.add-comment.outputs.comment-id") { t.Error("Generated YAML should contain comment-id output reference") } - if !strings.Contains(yamlContent, "steps.react.outputs.comment-url") { + if !strings.Contains(yamlContent, "steps.add-comment.outputs.comment-url") { t.Error("Generated YAML should contain comment-url output reference") } - if !strings.Contains(yamlContent, "steps.react.outputs.comment-repo") { + if !strings.Contains(yamlContent, "steps.add-comment.outputs.comment-repo") { t.Error("Generated YAML should contain comment-repo output reference") } - // Verify reaction step is in activation job, not a separate add_reaction job - if strings.Contains(yamlContent, "add_reaction:") { - t.Error("Generated YAML should not contain separate add_reaction job") + // Verify reaction is in pre-activation job for immediate feedback + if !strings.Contains(yamlContent, "Add eyes reaction for immediate feedback") { + t.Error("Generated YAML should contain reaction step in pre-activation job") } } diff --git a/pkg/workflow/task_and_reaction_permissions_test.go b/pkg/workflow/task_and_reaction_permissions_test.go index a870c1a812..ac5193c7fb 100644 --- a/pkg/workflow/task_and_reaction_permissions_test.go +++ b/pkg/workflow/task_and_reaction_permissions_test.go @@ -99,8 +99,9 @@ The activation job references text output: "${{ needs.activation.outputs.text }} t.Error("Activation job should have pull-requests: write permission") } - // Test 6: Verify reaction step is in activation job - if !strings.Contains(activationJobSection, "Add eyes reaction to the triggering item") { - t.Error("Activation job should contain the reaction step") + // Test 6: Verify reaction step is in pre-activation job (moved for immediate feedback) + preActivationJobSection := extractJobSection(lockContentStr, string(constants.PreActivationJobName)) + if !strings.Contains(preActivationJobSection, "Add eyes reaction for immediate feedback") { + t.Error("Pre-activation job should contain the reaction step") } }