-
-
Notifications
You must be signed in to change notification settings - Fork 40
43 lines (40 loc) · 1.42 KB
/
check-pr-title.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Check PR title
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize
jobs:
lint:
runs-on: ubuntu-latest
steps:
- id: lint
# SEE https://github.com/amannn/action-semantic-pull-request
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/[email protected]
if: ${{ failure() }}
# do not use user injected variable values directly here as they are
# open to injection attacks
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
env:
TITLE: ${{ github.event.pull_request.title }}
ERROR: ${{ steps.lint.outputs.error_message }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# javascript
script: |
const output = `The pull-request title "${{ env.TITLE}}" does not apply to [Conventional Commit Guidelines](https://www.conventionalcommits.org).
\`\`\`
${{ env.ERROR }}
\`\`\`
<sub>🤖 This comment was automatically created by the "${{github.workflow}}" workflow.</sup>`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})