Skip to content

Commit 38540f1

Browse files
turegjorupclaude
andcommitted
6654: Apply YAML/Prettier formatting and regenerate API spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f589268 commit 38540f1

34 files changed

Lines changed: 952 additions & 919 deletions

.github/workflows/api-spec.yaml

Lines changed: 136 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,143 @@
11
name: API Specification
22

33
on:
4-
pull_request:
5-
paths:
6-
- "src/**/*.php"
7-
- "config/**"
8-
- "composer.json"
9-
- "composer.lock"
10-
- "public/api-spec-v1.yaml"
11-
- "public/api-spec-v1.json"
12-
- "docker-compose.yml"
4+
pull_request:
5+
paths:
6+
- "src/**/*.php"
7+
- "config/**"
8+
- "composer.json"
9+
- "composer.lock"
10+
- "public/api-spec-v1.yaml"
11+
- "public/api-spec-v1.json"
12+
- "docker-compose.yml"
1313

1414
env:
15-
COMPOSE_USER: runner
15+
COMPOSE_USER: runner
1616

1717
jobs:
18-
api-spec-export:
19-
name: Ensure API specification is up to date
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v6
24-
25-
- name: Create docker network
26-
run: docker network create frontend
27-
28-
- name: Export API specification
29-
run: |
30-
docker compose up --detach
31-
docker compose exec phpfpm composer install --no-interaction
32-
docker compose exec phpfpm composer update-api-spec
33-
34-
- name: Check for uncommitted changes
35-
id: git-diff-spec
36-
continue-on-error: true
37-
run: |
38-
git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml public/api-spec-v1.json
39-
40-
- name: Comment PR if spec is outdated
41-
if: steps.git-diff-spec.outcome == 'failure'
42-
env:
43-
GH_TOKEN: ${{ github.token }}
44-
run: |
45-
gh pr comment ${{ github.event.pull_request.number }} \
46-
--body "$(cat <<'EOF'
47-
## API specification not up to date
48-
49-
The committed API specification files do not match the exported output.
50-
51-
Please run the following command, then commit and push the changes:
52-
53-
```shell
54-
docker compose exec phpfpm composer update-api-spec
55-
```
56-
EOF
57-
)" \
58-
--create-if-none --edit-last
59-
60-
- name: Fail if spec is outdated
61-
if: steps.git-diff-spec.outcome == 'failure'
62-
run: exit 1
63-
64-
api-spec-breaking-changes:
65-
name: Detect breaking changes in API specification
66-
runs-on: ubuntu-latest
67-
needs: [api-spec-export]
68-
permissions:
69-
pull-requests: write
70-
steps:
71-
- name: Checkout
72-
uses: actions/checkout@v6
73-
74-
- name: Fetch base branch for comparison
75-
run: git fetch --depth=1 origin ${{ github.base_ref }}
76-
77-
- name: Detect breaking changes
78-
id: breaking
79-
continue-on-error: true
80-
uses: oasdiff/oasdiff-action/breaking@main
81-
with:
82-
base: 'origin/${{ github.base_ref }}:public/api-spec-v1.yaml'
83-
revision: 'public/api-spec-v1.yaml'
84-
fail-on: ERR
85-
86-
- name: Generate changelog
87-
id: changelog
88-
continue-on-error: true
89-
uses: oasdiff/oasdiff-action/changelog@main
90-
with:
91-
base: 'origin/${{ github.base_ref }}:public/api-spec-v1.yaml'
92-
revision: 'public/api-spec-v1.yaml'
93-
format: markdown
94-
output-to-file: changelog.md
95-
96-
- name: Comment PR - no changes
97-
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') == ''
98-
env:
99-
GH_TOKEN: ${{ github.token }}
100-
run: |
101-
gh pr comment ${{ github.event.pull_request.number }} \
102-
--body "## API Specification
103-
104-
No changes detected in API specification." \
105-
--create-if-none --edit-last
106-
107-
- name: Comment PR - non-breaking changes
108-
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') != ''
109-
env:
110-
GH_TOKEN: ${{ github.token }}
111-
run: |
112-
{
113-
echo "## API Specification - Non-breaking changes"
114-
echo ""
115-
cat changelog.md
116-
} > comment.md
117-
gh pr comment ${{ github.event.pull_request.number }} \
118-
--body-file comment.md \
119-
--create-if-none --edit-last
120-
121-
- name: Comment PR - breaking changes
122-
if: steps.breaking.outcome == 'failure'
123-
env:
124-
GH_TOKEN: ${{ github.token }}
125-
run: |
126-
{
127-
echo "## API Specification - Breaking changes detected"
128-
echo ""
129-
if [ -s changelog.md ]; then
130-
cat changelog.md
131-
else
132-
echo "The breaking changes action detected incompatible changes. Review the action logs for details."
133-
fi
134-
} > comment.md
135-
gh pr comment ${{ github.event.pull_request.number }} \
136-
--body-file comment.md \
137-
--create-if-none --edit-last
138-
139-
- name: Fail if breaking changes detected
140-
if: steps.breaking.outcome == 'failure'
141-
run: exit 1
18+
api-spec-export:
19+
name: Ensure API specification is up to date
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Create docker network
26+
run: docker network create frontend
27+
28+
# https://taskfile.dev/installation/#github-actions
29+
- uses: go-task/setup-task@v1
30+
31+
- name: Export API specification
32+
run: |
33+
task site:update
34+
task api:spec:export
35+
36+
- name: Check for uncommitted changes
37+
id: git-diff-spec
38+
continue-on-error: true
39+
run: |
40+
git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml public/api-spec-v1.json
41+
42+
- name: Comment PR if spec is outdated
43+
if: steps.git-diff-spec.outcome == 'failure'
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
gh pr comment ${{ github.event.pull_request.number }} \
48+
--body "$(cat <<'EOF'
49+
## API specification not up to date
50+
51+
The committed API specification files do not match the exported output.
52+
53+
Please run the following command, then commit and push the changes:
54+
55+
```shell
56+
docker compose exec phpfpm composer update-api-spec
57+
```
58+
EOF
59+
)" \
60+
--create-if-none --edit-last
61+
62+
- name: Fail if spec is outdated
63+
if: steps.git-diff-spec.outcome == 'failure'
64+
run: exit 1
65+
66+
api-spec-breaking-changes:
67+
name: Detect breaking changes in API specification
68+
runs-on: ubuntu-latest
69+
needs: [api-spec-export]
70+
permissions:
71+
pull-requests: write
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v6
75+
76+
- name: Fetch base branch for comparison
77+
run: git fetch --depth=1 origin ${{ github.base_ref }}
78+
79+
- name: Detect breaking changes
80+
id: breaking
81+
continue-on-error: true
82+
uses: oasdiff/oasdiff-action/breaking@main
83+
with:
84+
base: "origin/${{ github.base_ref }}:public/api-spec-v1.yaml"
85+
revision: "public/api-spec-v1.yaml"
86+
fail-on: ERR
87+
88+
- name: Generate changelog
89+
id: changelog
90+
continue-on-error: true
91+
uses: oasdiff/oasdiff-action/changelog@main
92+
with:
93+
base: "origin/${{ github.base_ref }}:public/api-spec-v1.yaml"
94+
revision: "public/api-spec-v1.yaml"
95+
format: markdown
96+
output-to-file: changelog.md
97+
98+
- name: Comment PR - no changes
99+
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') == ''
100+
env:
101+
GH_TOKEN: ${{ github.token }}
102+
run: |
103+
gh pr comment ${{ github.event.pull_request.number }} \
104+
--body "## API Specification
105+
106+
No changes detected in API specification." \
107+
--create-if-none --edit-last
108+
109+
- name: Comment PR - non-breaking changes
110+
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') != ''
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
run: |
114+
{
115+
echo "## API Specification - Non-breaking changes"
116+
echo ""
117+
cat changelog.md
118+
} > comment.md
119+
gh pr comment ${{ github.event.pull_request.number }} \
120+
--body-file comment.md \
121+
--create-if-none --edit-last
122+
123+
- name: Comment PR - breaking changes
124+
if: steps.breaking.outcome == 'failure'
125+
env:
126+
GH_TOKEN: ${{ github.token }}
127+
run: |
128+
{
129+
echo "## API Specification - Breaking changes detected"
130+
echo ""
131+
if [ -s changelog.md ]; then
132+
cat changelog.md
133+
else
134+
echo "The breaking changes action detected incompatible changes. Review the action logs for details."
135+
fi
136+
} > comment.md
137+
gh pr comment ${{ github.event.pull_request.number }} \
138+
--body-file comment.md \
139+
--create-if-none --edit-last
140+
141+
- name: Fail if breaking changes detected
142+
if: steps.breaking.outcome == 'failure'
143+
run: exit 1

.github/workflows/changelog.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
name: Changelog
1010

1111
on:
12-
pull_request:
12+
pull_request:
1313

1414
jobs:
15-
changelog:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v6
20-
with:
21-
fetch-depth: 2
15+
changelog:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 2
2222

23-
- name: Git fetch
24-
run: git fetch
23+
- name: Git fetch
24+
run: git fetch
2525

26-
- name: Check that changelog has been updated.
27-
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0
26+
- name: Check that changelog has been updated.
27+
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

0 commit comments

Comments
 (0)