Skip to content

notify slack and triage labels#2211

Merged
ofek1weiss merged 2 commits intomasterfrom
app-1004-triage-labels-notify-slack
Apr 26, 2026
Merged

notify slack and triage labels#2211
ofek1weiss merged 2 commits intomasterfrom
app-1004-triage-labels-notify-slack

Conversation

@ofek1weiss
Copy link
Copy Markdown
Contributor

@ofek1weiss ofek1weiss commented Apr 26, 2026

Summary by CodeRabbit

  • Chores
    • Updated internal notification workflow for improved reliability and maintainability.
    • Enhanced automated issue labeling workflow with pinned dependency versions for better stability and consistency.

@linear
Copy link
Copy Markdown

linear Bot commented Apr 26, 2026

@github-actions
Copy link
Copy Markdown
Contributor

👋 @ofek1weiss
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

Both GitHub Actions workflows are refactored to improve security and implementation approach. The notify Slack workflow adds explicit permissions, refactors input handling, and reimplements Slack notification logic using shell commands and curl instead of a dedicated action. The triage labels workflow replaces a deprecated third-party action with a pinned GitHub Script that performs label operations via GitHub REST API calls.

Changes

Cohort / File(s) Summary
Slack Notification Workflow
.github/workflows/notify_slack.yml
Adds workflow-wide empty permissions block; refactors input echoing through environment variables; replaces Slack action with inline implementation using jq to construct JSON payload and curl to POST to webhook endpoint with computed RUN_URL from GitHub context.
Triage Labels Workflow
.github/workflows/triage-labels.yml
Replaces andymckay/labeler@master action with pinned actions/github-script action; re-implements label management via GitHub REST API calls to add "Triage 👀" and remove "Awaiting Response" labels.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Our workflows grow stronger, more secure and spry,
With permissions locked down and REST calls high,
No third-party magic, just curl and good cheer,
The Slack messages flow, the labels appear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'notify slack and triage labels' accurately summarizes the two main changes in the pull request: refactoring the Slack notification workflow and updating the triage labels workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch app-1004-triage-labels-notify-slack

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/notify_slack.yml:
- Line 43: The workflow always constructs RUN_URL using inputs.run_id but the
input is optional, causing broken links when omitted; either mark the input as
required in the notify_slack.yml inputs block (set inputs.run_id required: true)
or change the RUN_URL assignment to guarded/default behavior so it only builds
when inputs.run_id exists (fallback to github.run_id or omit the URL) — update
the RUN_URL environment entry and/or the inputs.run_id declaration accordingly
to ensure a valid run link is produced.

In @.github/workflows/triage-labels.yml:
- Around line 27-32: The removeLabel call (github.rest.issues.removeLabel) can
throw a 404 if the "Awaiting Response" label is already gone; wrap the await
github.rest.issues.removeLabel({ owner, repo, issue_number, name: "Awaiting
Response" }) in a try/catch and silently ignore errors where err.status === 404
(or the Not Found message), but rethrow all other errors so genuine failures
still surface.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 380c55ce-881b-4a2b-9a1a-2be82030c88b

📥 Commits

Reviewing files that changed from the base of the PR and between d3149ff and a2e9221.

📒 Files selected for processing (2)
  • .github/workflows/notify_slack.yml
  • .github/workflows/triage-labels.yml

}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
WORKFLOW_NAME: ${{ inputs.workflow_name }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.run_id }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

run_id is treated as required at runtime but optional in inputs.

Line 43 always builds RUN_URL from inputs.run_id. If callers omit it, Slack gets a broken run link. Either make run_id required or add explicit fallback/guard logic.

Proposed fix (make input contract explicit)
 on:
   workflow_call:
     inputs:
       run_id:
         type: string
-        required: false
+        required: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/notify_slack.yml at line 43, The workflow always
constructs RUN_URL using inputs.run_id but the input is optional, causing broken
links when omitted; either mark the input as required in the notify_slack.yml
inputs block (set inputs.run_id required: true) or change the RUN_URL assignment
to guarded/default behavior so it only builds when inputs.run_id exists
(fallback to github.run_id or omit the URL) — update the RUN_URL environment
entry and/or the inputs.run_id declaration accordingly to ensure a valid run
link is produced.

Comment on lines +27 to +32
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: "Awaiting Response",
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

GitHub REST API: For issues.removeLabel, what status/error is returned when the target label is not present on the issue?

💡 Result:

The GitHub REST API endpoint for removing a label from an issue (DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}, corresponding to issues.removeLabel in client libraries like Octokit) returns a 404 Not Found status code when the target label is not present on the issue.

Citations:


Make label removal idempotent to prevent flaky failures.

The removeLabel call will fail with a 404 if "Awaiting Response" was already removed by another workflow run or manual edit, causing the job to fail despite the desired end state being achieved. Wrap the call in a try/catch to ignore 404 errors.

Proposed patch
             await github.rest.issues.addLabels({
               owner,
               repo,
               issue_number,
               labels: ["Triage 👀"],
             });
 
-            await github.rest.issues.removeLabel({
-              owner,
-              repo,
-              issue_number,
-              name: "Awaiting Response",
-            });
+            try {
+              await github.rest.issues.removeLabel({
+                owner,
+                repo,
+                issue_number,
+                name: "Awaiting Response",
+              });
+            } catch (error) {
+              if (error.status !== 404) throw error;
+            }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: "Awaiting Response",
});
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: ["Triage 👀"],
});
try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: "Awaiting Response",
});
} catch (error) {
if (error.status !== 404) throw error;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/triage-labels.yml around lines 27 - 32, The removeLabel
call (github.rest.issues.removeLabel) can throw a 404 if the "Awaiting Response"
label is already gone; wrap the await github.rest.issues.removeLabel({ owner,
repo, issue_number, name: "Awaiting Response" }) in a try/catch and silently
ignore errors where err.status === 404 (or the Not Found message), but rethrow
all other errors so genuine failures still surface.

@ofek1weiss ofek1weiss merged commit 8c1eaff into master Apr 26, 2026
9 of 23 checks passed
@ofek1weiss ofek1weiss deleted the app-1004-triage-labels-notify-slack branch April 26, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants