| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 08b5347 commit b655edf
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,36 +27,20 @@ jobs: | |||
| 27 | 27 | SLACK_USERNAME: nodejs-bot | |
| 28 | 28 | SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| 29 | 29 | ||
| 30 | - notifyOnMissingMetadata: | ||
| 31 | - name: Notify on Push on `main` that lacks metadata | ||
| 30 | + validateCommitMessage: | ||
| 31 | + name: Notify on Push on `main` with invalid message | ||
| 32 | 32 | if: github.repository == 'nodejs/node' | |
| 33 | 33 | runs-on: ubuntu-latest | |
| 34 | - permissions: | ||
| 35 | - contents: read | ||
| 36 | - pull-requests: write | ||
| 37 | 34 | steps: | |
| 38 | 35 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| 39 | 36 | with: | |
| 40 | 37 | persist-credentials: false | |
| 41 | 38 | - 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" | ||
| 56 | 40 | env: | |
| 57 | - GH_TOKEN: ${{ github.token }} | ||
| 41 | + COMMIT: ${{ github.event.after }} | ||
| 58 | 42 | - name: Slack Notification | |
| 59 | - if: ${{ env.INVALID_COMMIT_MESSAGE }} | ||
| 43 | + if: failure() | ||
| 60 | 44 | uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3 | |
| 61 | 45 | env: | |
| 62 | 46 | SLACK_COLOR: '#DE512A' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments