Skip to content

Commit 1744ef1

Browse files
authored
Merge pull request #151 from salesforcecli/ew/more-checks
@W-21263659: new check for dependabot
2 parents a5fe0a3 + 388958f commit 1744ef1

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/create-github-release.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,33 @@ jobs:
106106
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
107107
skipIfReleaseExists: true
108108

109-
- name: Check for Slack webhook
110-
id: check-slack
109+
# Determine if we should alert Slack that the release was skipped.
110+
# Skip the alert if: no webhook is configured, or the commit is from a Dependabot merge.
111+
- name: Should we post to Slack that release was skipped
112+
id: should-post-slack
113+
if: steps.changelog.outputs.skipped == 'true'
111114
run: |
112-
if [ -n "$SLACK_WEBHOOK" ]; then
113-
echo "has_webhook=true" >> "$GITHUB_OUTPUT"
115+
if [ -z "$SLACK_WEBHOOK" ]; then
116+
echo "[INFO] No Slack webhook configured, skipping alert"
117+
exit 0
114118
fi
119+
120+
PR_AUTHOR=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" --jq '.[0].user.login // empty')
121+
echo "[INFO] PR author: $PR_AUTHOR"
122+
123+
if [ "$PR_AUTHOR" = "dependabot[bot]" ]; then
124+
echo "[INFO] Dependabot merge, skipping alert"
125+
exit 0
126+
fi
127+
128+
echo "post_skipped_release_to_slack=true" >> "$GITHUB_OUTPUT"
115129
env:
116130
SLACK_WEBHOOK: ${{ secrets.CLI_ALERTS_SLACK_WEBHOOK }}
131+
GH_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
117132

118133
- name: Announce if Github Release was skipped
119134
id: slack
120-
if: ${{ steps.changelog.outputs.skipped == 'true' && github.actor != 'dependabot[bot]' && steps.check-slack.outputs.has_webhook == 'true' }}
135+
if: steps.should-post-slack.outputs.post_skipped_release_to_slack == 'true'
121136
uses: slackapi/slack-github-action@v1.26.0
122137
env:
123138
# for non-CLI-team-owned plugins, you can send this anywhere you like

0 commit comments

Comments
 (0)