Commit Message Check #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CommitMessageCheck | |
run-name: Commit Message Check | |
on: | |
pull_request: | |
types: [opened, edited, reopened, synchronize] | |
branches: main | |
concurrency: | |
group: 'check_commit' | |
cancel-in-progress: true | |
jobs: | |
check-commit-message: | |
environment: github-pages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Get PR Commits | |
id: 'get-pr-commits' | |
uses: tim-actions/get-pr-commits@master | |
with: | |
token: ${{ secrets.CHECK_COMMIT_GITHUB_TOKEN }} | |
- name: Setup variables | |
run: | | |
documentationUrl=$(cat ./public/CNAME) | |
echo "DOCUMENTATION_URL=${documentationUrl}" >> $GITHUB_ENV | |
- name: Check PR commits | |
run: | | |
echo ${{ steps.get-pr-commits.outputs.commits }} > commits.json | |
cat commits.json | |
- name: WIP notice | |
run: | | |
echo "This is WIP (work in progress)" | |
cat ./public/CNAME | |
- name: Post PR Comment | |
if: failure() | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message: Please check the commit messages in this PR! It seems that you have not used emojis, this is a requirement for this project as per our documentation ${{ env.DOCUMENTATION_URL }} | |
refresh-message-position: true | |
allow-repeats: true |