0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-22 07:37:56 +01:00
nodejs/.github/workflows/notify-on-push.yml
dependabot[bot] 71a1fa3043
meta: bump actions/checkout from 4.1.1 to 4.1.4
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
PR-URL: https://github.com/nodejs/node/pull/52787
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-05-03 18:33:01 +00:00

71 lines
3.4 KiB
YAML

on:
push:
branches:
- main
name: Notify on Push
permissions:
contents: read
jobs:
notifyOnForcePush:
name: Notify on Force Push on `main`
if: github.repository == 'nodejs/node' && github.event.forced
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 # 2.3.0
env:
SLACK_COLOR: '#DE512A'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: ${{ github.actor }} force-pushed to ${{ github.ref }}
SLACK_MESSAGE: |
<!here> A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.repository }}@${{ github.ref_name }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
SLACK_USERNAME: nodejs-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
notifyOnMissingMetadata:
name: Notify on Push on `main` that lacks metadata
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
persist-credentials: false
- name: Check commit message
run: npx -q core-validate-commit ${{ github.event.after }} || echo "INVALID_COMMIT_MESSAGE=1" >> $GITHUB_ENV
- name: Retrieve PR number if possible
if: env.INVALID_COMMIT_MESSAGE
run: |
COMMIT_TITLE=$(git --no-pager log --oneline -1 --no-color) node <<'EOF' >> $GITHUB_ENV || true
const invalidCommitMessageMatch = /\s\(\#(\d+)\)$/.exec(process.env.COMMIT_TITLE);
if (invalidCommitMessageMatch == null) process.exit(1)
console.log(`PR_ID=${invalidCommitMessageMatch[1]}`)
EOF
- name: Comment on the Pull Request
if: ${{ env.PR_ID }}
run: |
gh pr comment ${{ env.PR_ID }} --repo "${{ github.repository }}" \
--body "A commit referencing this Pull Request was pushed to `${{ github.ref_name }}` by @${{ github.actor }} with an invalid commit message."
env:
GH_TOKEN: ${{ github.token }}
- name: Slack Notification
if: ${{ env.INVALID_COMMIT_MESSAGE }}
uses: rtCamp/action-slack-notify@4e5fb42d249be6a45a298f3c9543b111b02f7907 # 2.3.0
env:
SLACK_COLOR: '#DE512A'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: Invalid commit was pushed to ${{ github.repository.default_branch }}
SLACK_MESSAGE: |
<!here> A commit with an invalid message was pushed to <https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.repository }}@${{ github.ref_name }}> by <https://github.com/${{ github.actor }}|${{ github.actor }}>.
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
SLACK_USERNAME: nodejs-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}