Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/regenerate-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ jobs:
node-version: 20
cache: npm

- run: npm ci --ignore-scripts
- name: Install latest SDK tooling
run: |
set -euo pipefail
npm install --ignore-scripts --save-dev \
@archastro/sdk-generator@latest \
@archastro/channel-harness@latest
npm pkg set \
devDependencies.@archastro/sdk-generator=latest \
devDependencies.@archastro/channel-harness=latest
npm install --package-lock-only --ignore-scripts

- name: Audit JS tooling dependencies
run: npm audit --audit-level=moderate
Expand Down Expand Up @@ -65,12 +74,12 @@ jobs:
- name: Detect changes
id: diff
run: |
if [ -z "$(git status --porcelain src tests specs)" ]; then
if [ -z "$(git status --porcelain package.json package-lock.json src tests specs)" ]; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes from regeneration; nothing to do."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
git status --short src tests specs
git status --short package.json package-lock.json src tests specs
fi

- name: Resolve generator version
Expand All @@ -91,7 +100,7 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$AUTO_BRANCH"
git add src tests specs
git add package.json package-lock.json src tests specs
git commit -m "chore(sdk): regenerate from archastro-openapi@$REF (generator $GEN_VERSION)"
git push --force-with-lease origin "$AUTO_BRANCH"

Expand All @@ -103,12 +112,12 @@ jobs:
GEN_VERSION: ${{ steps.gen.outputs.version }}
run: |
set -euo pipefail
file_count=$(git diff --name-only HEAD~1 HEAD -- src tests specs | wc -l | tr -d ' ')
file_count=$(git diff --name-only HEAD~1 HEAD -- package.json package-lock.json src tests specs | wc -l | tr -d ' ')
body=$(cat <<EOF
Automated SDK regeneration.

- **archastro-openapi ref**: \`$REF\`
- **generator version**: \`$GEN_VERSION\` from package-lock.json
- **generator version**: \`$GEN_VERSION\` resolved from npm latest and locked in package-lock.json
- **changed files**: $file_count

Review the diff carefully — generator output changes can be subtle. The PR's CI will run lint + tests.
Expand Down
34 changes: 26 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"regenerate": "bash scripts/regenerate_sdk.sh"
},
"devDependencies": {
"@archastro/channel-harness": "^0.1.0",
"@archastro/sdk-generator": "0.1.0",
"@archastro/channel-harness": "latest",
"@archastro/sdk-generator": "latest",
"@stoplight/prism-cli": "5.14.2"
},
"overrides": {
Expand Down
Loading