Skip to content

Commit 25947d6

Browse files
authored
tools: simplify notify-on-push
Now that we have the repo setup to reject commits that do not contain any metadata, we can remove the custom logic that was trying to catch commits merged using the default commit message. PR-URL: #61050 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e201759 commit 25947d6

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

.github/workflows/notify-on-push.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,20 @@ jobs:
2727
SLACK_USERNAME: nodejs-bot
2828
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2929

30-
notifyOnMissingMetadata:
31-
name: Notify on Push on `main` that lacks metadata
30+
validateCommitMessage:
31+
name: Notify on Push on `main` with invalid message
3232
if: github.repository == 'nodejs/node'
3333
runs-on: ubuntu-latest
34-
permissions:
35-
contents: read
36-
pull-requests: write
3734
steps:
3835
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3936
with:
4037
persist-credentials: false
4138
- name: Check commit message
42-
run: npx -q core-validate-commit ${{ github.event.after }} || echo "INVALID_COMMIT_MESSAGE=1" >> $GITHUB_ENV
43-
- name: Retrieve PR number if possible
44-
if: env.INVALID_COMMIT_MESSAGE
45-
run: |
46-
COMMIT_TITLE=$(git --no-pager log --oneline -1 --no-color) node <<'EOF' >> $GITHUB_ENV || true
47-
const invalidCommitMessageMatch = /\s\(\#(\d+)\)$/.exec(process.env.COMMIT_TITLE);
48-
if (invalidCommitMessageMatch == null) process.exit(1)
49-
console.log(`PR_ID=${invalidCommitMessageMatch[1]}`)
50-
EOF
51-
- name: Comment on the Pull Request
52-
if: ${{ env.PR_ID }}
53-
run: |
54-
gh pr comment ${{ env.PR_ID }} --repo "${{ github.repository }}" \
55-
--body "A commit referencing this Pull Request was pushed to `${{ github.ref_name }}` by @${{ github.actor }} with an invalid commit message."
39+
run: npx -q core-validate-commit "$COMMIT"
5640
env:
57-
GH_TOKEN: ${{ github.token }}
41+
COMMIT: ${{ github.event.after }}
5842
- name: Slack Notification
59-
if: ${{ env.INVALID_COMMIT_MESSAGE }}
43+
if: failure()
6044
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3
6145
env:
6246
SLACK_COLOR: '#DE512A'

0 commit comments

Comments
 (0)