GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools: notify on Slack when invalid commit lands · nodejs/node@3f49da5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • notify-force-push.yml
    • notify-on-push.yml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/notify-force-push.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/notify-force-push.yml
-28Lines changed: 0 additions & 28 deletions
This file was deleted.
Collapse file

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

Copy file name to clipboard
+66Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
name: Notify on Push
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
notifyOnForcePush:
12+
name: Notify on Force Push on `main`
13+
if: github.repository == 'nodejs/node' && github.event.forced
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Slack Notification
17+
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
18+
env:
19+
SLACK_COLOR: '#DE512A'
20+
SLACK_ICON: https://github.com/nodejs.png?size=48
21+
SLACK_TITLE: ${{ github.actor }} force-pushed to ${{ github.ref }}
22+
SLACK_MESSAGE: |
23+
A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/${{ github.repository.default_branch }}|${{ github.repository }}@${{ github.repository.default_branch }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
24+
25+
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
26+
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
27+
SLACK_USERNAME: nodejs-bot
28+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
29+
30+
notifyOnMissingMetadata:
31+
name: Notify on Push on `main` that lacks metadata
32+
if: github.repository == 'nodejs/node'
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Check commit message
36+
run: npx -q core-validate-commit ${{ github.event.commits[0].id }} || echo "INVALID_COMMIT_MESSAGE=1" >> $GITHUB_ENV
37+
- name: Retrieve PR number if possible
38+
if: ${{ env.INVALID_COMMIT_MESSAGE }}
39+
run: |
40+
node <<<'EOF'
41+
const invalidCommitMessageMatch = /\s\(\#\d+\)$/.exec(process.env.COMMIT_MESSAGE);
42+
if (match == null) process.exit(1)
43+
console.log(`PR_ID=${match[0]}`)
44+
EOF >> $GITHUB_ENV || true
45+
env:
46+
COMMIT_MESSAGE: ${{ github.event.commits[0].message }}
47+
- name: Comment on the Pull Request
48+
if: ${{ env.PR_ID }}
49+
run: gh pr comment ${{ env.PR_ID }} --repo "${{ github.repository }}" --body "$BODY"
50+
env:
51+
BODY: |
52+
A commit referencing this Pull Request was pushed to `main` by @${{ github.actor }} without the expected commit metadata added to its message.
53+
- name: Slack Notification
54+
if: ${{ env.INVALID_COMMIT_MESSAGE }}
55+
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
56+
env:
57+
SLACK_COLOR: '#DE512A'
58+
SLACK_ICON: https://github.com/nodejs.png?size=48
59+
SLACK_TITLE: Invalid commit was pushed to ${{ github.repository.default_branch }}
60+
SLACK_MESSAGE: |
61+
A commit lacking the expected metadata was pushed to <https://github.com/${{ github.repository }}/tree/${{ github.repository.default_branch }}|${{ github.repository }}@${{ github.repository.default_branch }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>.
62+
63+
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
64+
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
65+
SLACK_USERNAME: nodejs-bot
66+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.