Skip to content

chore: add slack notification for lockfile update PRs#4

Closed
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
bw/slack-notification
Closed

chore: add slack notification for lockfile update PRs#4
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
bw/slack-notification

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Adds a Slack webhook notification step to the reusable update-lockfile workflow. Accepts an optional SLACK_WEBHOOK_URL secret — when provided, posts the PR URL to Slack after a lockfile update PR is created.

Changes

  • Added SLACK_WEBHOOK_URL as an optional secret in workflow_call
  • Added a "Notify Slack" step that fires only when a PR URL exists and the secret is provided

Type of Change

  • New feature

Testing

  • Manually tested

Checklist

  • Self-reviewed the diff
  • No debug/dead code left in

Notes

Merge this before the benchmark service caller PRs so the secret is accepted. The secret is optional (required: false) so existing callers won't break if SLACK_WEBHOOK_URL isn't provisioned yet.

Link to Devin session: https://app.devin.ai/sessions/7768353d8ede429eb108f2c272e88747
Requested by: @BradenBug

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@assert-app
Copy link
Copy Markdown

assert-app Bot commented Apr 30, 2026

Review on Assert →

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

delete-branch: true

- name: Notify Slack
if: steps.cpr.outputs.pull-request-url && secrets.SLACK_WEBHOOK_URL
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔴 secrets context in step if: conditional may always evaluate to empty string

GitHub Actions documentation states that secrets cannot be directly referenced in if: conditionals. The condition secrets.SLACK_WEBHOOK_URL on line 40 may always evaluate to an empty string (falsy), causing the Slack notification step to never execute even when the secret is provided by the calling workflow. The recommended pattern is to set the secret as an environment variable at the job level and then check env.SLACK_WEBHOOK_URL != '' in the if: condition.

Recommended pattern

Define the env at job level, then use it in the if: condition:

jobs:
  update:
    runs-on: ubuntu-latest
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
    steps:
      ...
      - name: Notify Slack
        if: steps.cpr.outputs.pull-request-url && env.SLACK_WEBHOOK_URL
        run: |
          curl -sf -X POST "$SLACK_WEBHOOK_URL" ...
Prompt for agents
The `if` condition on line 40 references `secrets.SLACK_WEBHOOK_URL` directly, which GitHub Actions documentation warns against — secrets may not be accessible in `if:` conditionals and may always evaluate as empty. The fix is to set the secret as a job-level environment variable and reference it via `env` context instead.

In .github/workflows/update-lockfile.yaml, add an `env` block at the job level (under `jobs.update`) mapping SLACK_WEBHOOK_URL to the secret, then change the `if:` condition from `secrets.SLACK_WEBHOOK_URL` to `env.SLACK_WEBHOOK_URL`. You can then remove the step-level `env` block since it's already defined at the job level.

Job-level env:
  jobs:
    update:
      runs-on: ubuntu-latest
      env:
        SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Step if condition change:
  if: steps.cpr.outputs.pull-request-url && env.SLACK_WEBHOOK_URL
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@BradenBug BradenBug closed this Apr 30, 2026
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.

1 participant