-
Notifications
You must be signed in to change notification settings - Fork 24
40 lines (38 loc) · 1.5 KB
/
pr-title-format.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
name: '🔣 PR title format'
on:
pull_request:
types: [ opened, edited, synchronize ]
merge_group:
types: [ checks_requested ]
jobs:
commitizen:
runs-on: ubuntu-latest
if: github.repository == 'adevinta/spark-android' && github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: '.github/requirements.txt'
- run: pip install -r .github/requirements.txt
- id: check
name: 'Check title format'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: cz check --message "$PR_TITLE" >> $GITHUB_STEP_SUMMARY 2>&1
- if: ${{ failure() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
BADGE_SVG: ${{ github.server_url }}/${{ github.repository }}/actions/workflows/pr-title-format.yml/badge.svg?branch=${{ github.head_ref }}&event=pull_request
BADGE_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
( \
echo -e "[![$GITHUB_WORKFLOW]($BADGE_SVG)]($BADGE_URL)" ; \
echo -e "" ; \
echo -e "\`\`\`" ; \
cz check --message "$PR_TITLE" 2>&1 ; \
echo -e "\`\`\`" ; \
) | gh pr comment "$PR_NUMBER" --body-file -