|
1 | 1 | ---
|
2 | 2 |
|
3 |
| -name: PR |
4 |
| -on: |
| 3 | +name: Pull requests |
| 4 | +on: # yamllint disable-line rule:truthy |
5 | 5 | pull_request:
|
6 | 6 | types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - # Enforces the update of a changelog file on every pull request |
| 9 | + update-changelog: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + name: "Pre-commit CI CHANGELOG auto-update" |
| 12 | + if: > |
| 13 | + (github.event.pull_request.title == '[pre-commit.ci] pre-commit autoupdate') && |
| 14 | + (github.event.action == 'opened') |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + with: |
| 18 | + ref: ${{ github.event.pull_request.head.ref }} |
| 19 | + fetch-depth: 0 |
| 20 | + token: ${{ secrets.PRE_COMMIT_CI_CHANGELOG }} |
| 21 | + |
| 22 | + - name: Setup Python |
| 23 | + uses: actions/setup-python@v3 |
| 24 | + with: |
| 25 | + python-version: '3.11' |
| 26 | + cache: 'pip' |
| 27 | + cache-dependency-path: '**/setup.cfg' |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: | |
| 31 | + python3 -m pip install 'git+https://github.com/Takishima/pre-commit-changelog-auto-update@v1.0.0' |
| 32 | +
|
| 33 | + - name: Run Python script |
| 34 | + run: | |
| 35 | + python3 -m update_changelog --pr-body "${{ github.event.pull_request.body }}" |
| 36 | +
|
| 37 | + - name: Commit changes |
| 38 | + id: commit |
| 39 | + uses: EndBug/add-and-commit@v9 |
| 40 | + with: |
| 41 | + author_name: github-actions[bot] |
| 42 | + author_email: noreply@github.com |
| 43 | + message: Update CHANGELOG |
| 44 | + |
10 | 45 | changelog:
|
| 46 | + needs: update-changelog |
11 | 47 | runs-on: ubuntu-latest
|
| 48 | + name: CHANGELOG enforcer |
| 49 | + if: '!cancelled()' |
12 | 50 | steps:
|
13 | 51 | - uses: actions/checkout@v3
|
| 52 | + with: |
| 53 | + ref: ${{ github.event.pull_request.head.ref }} |
| 54 | + fetch-depth: 0 |
14 | 55 |
|
15 |
| - - id: changelog-enforcer |
16 |
| - uses: dangoslen/changelog-enforcer@v3 |
| 56 | + - uses: dangoslen/changelog-enforcer@v3 |
17 | 57 | with:
|
18 | 58 | changeLogPath: 'CHANGELOG.md'
|
19 | 59 | skipLabels: 'Skip-Changelog'
|
0 commit comments