Skip to content

Commit 8062b54

Browse files
authored
ci: harden openapi auto-regeneration and streamline config (#968)
1 parent 1347a5a commit 8062b54

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/release-please-config.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
"path": "frontend/package.json",
1212
"jsonpath": "$.version"
1313
},
14-
"public/openapi.yaml",
15-
"frontend/src/api/generated/client.gen.ts",
16-
"frontend/src/api/generated/sdk.gen.ts",
17-
"frontend/src/api/generated/types.gen.ts",
18-
"frontend/src/api/generated/index.ts"
14+
"public/openapi.yaml"
1915
]
2016
}
2117
}

.github/workflows/ci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ jobs:
4747

4848
openapi:
4949
runs-on: ubuntu-latest
50+
permissions:
51+
contents: write
5052
steps:
5153
- uses: actions/checkout@v6
5254
with:
5355
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
56+
ref: ${{ (github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--')) && github.head_ref || github.sha }}
57+
fetch-depth: 0
5458

5559
- uses: ruby/setup-ruby@v1
5660
with:
@@ -87,11 +91,16 @@ jobs:
8791
make openapi-client
8892
8993
git add public/openapi.yaml frontend/src/api/generated/
90-
git commit -m "chore: regenerate openapi spec and client for version bump"
91-
git push
9294
93-
echo "## OpenAPI artifacts regenerated" >> "$GITHUB_STEP_SUMMARY"
94-
echo "Version bump detected; OpenAPI spec and frontend client have been regenerated and committed." >> "$GITHUB_STEP_SUMMARY"
95+
if git diff --staged --quiet; then
96+
echo "No changes to commit"
97+
else
98+
git commit -m "chore: regenerate openapi spec and client for version bump"
99+
git push origin ${{ github.head_ref }}
100+
101+
echo "## OpenAPI artifacts regenerated" >> "$GITHUB_STEP_SUMMARY"
102+
echo "Version bump detected; OpenAPI spec and frontend client have been regenerated and committed." >> "$GITHUB_STEP_SUMMARY"
103+
fi
95104
96105
- name: Lint OpenAPI contract
97106
run: make openapi-lint

0 commit comments

Comments
 (0)