chore: add Mathlib CI comments using the mathlib bot #1232
Workflow file for this run
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: sanity-check opened PRs | |
on: | |
# needs read/write GH token, do *not* execute arbitrary code from PR | |
pull_request_target: | |
types: [opened] | |
jobs: | |
check-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Commit Message | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { data: commits } = await github.rest.pulls.listCommits({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
}); | |
console.log(commits[0].commit.message); | |
// check first commit only (and only once) since later commits might be intended to be squashed away | |
if (!/^(feat|fix|doc|style|refactor|test|chore|perf): .*[^.]($|\n\n)/.test(commits[0].commit.message)) { | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: 'Thanks for your contribution! Please make sure to follow our [Commit Convention](https://leanprover.github.io/lean4/doc/dev/commit_convention.html).', | |
}); | |
} |