Skip to content

Commit 0901423

Browse files
committed
ci: move changelog and draft release checks to actions
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent c8db194 commit 0901423

5 files changed

Lines changed: 20 additions & 32 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,21 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
11-
- uses: shivammathur/setup-php@v2
1211
with:
13-
php-version: '8.2'
14-
- run: composer install --no-interaction --prefer-dist
15-
- run: composer bin qa install --no-interaction --prefer-dist
16-
- run: composer run changelog:check
12+
fetch-depth: 0
13+
- name: Check if CHANGELOG.md changed
14+
id: changed_files
15+
uses: tj-actions/changed-files@v46
16+
with:
17+
files: |
18+
CHANGELOG.md
19+
- name: Enforce changelog update for PRs
20+
if: github.actor != 'dependabot[bot]'
21+
run: |
22+
if [[ "${{ steps.changed_files.outputs.any_changed }}" != "true" ]]; then
23+
echo "CHANGELOG.md must be updated in this PR (or use dependabot flow)."
24+
exit 1
25+
fi
26+
- name: Validate Keep a Changelog structure
27+
run: |
28+
grep -q '^## \[Unreleased\]' CHANGELOG.md

.github/workflows/release-draft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: release-draft
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
67

78
jobs:
89
release-draft:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
"composer:normalize:check": "vendor-bin/qa/vendor/ergebnis/composer-normalize/bin/composer-normalize --dry-run",
6060
"bc:check": "vendor-bin/qa/vendor/roave/backward-compatibility-check/bin/roave-backward-compatibility-check --from=origin/main --to=HEAD",
6161
"licenses:check": "php scripts/licenses-check.php",
62-
"changelog:check": "php scripts/changelog-check.php",
63-
"release:draft": "php scripts/release-draft.php",
62+
"changelog:check": "echo 'Handled by GitHub Action: .github/workflows/changelog.yml'",
63+
"release:draft": "echo 'Handled by GitHub Action: .github/workflows/release-draft.yml'",
6464
"deps:audit": "composer audit",
6565
"docker:lint": "docker run --rm -i hadolint/hadolint < .docker/Dockerfile",
6666
"sh:lint": "shfmt -d scripts",

scripts/changelog-check.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

scripts/release-draft.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)