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
54 changes: 54 additions & 0 deletions .github/workflows/update-v3-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update Acquia v3 API spec

on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:

jobs:
update-spec:
runs-on: ubuntu-24.04
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v7

- uses: shivammathur/setup-php@v2
with:
coverage: none

- name: Install dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Download latest v3 spec
run: composer update-acquia-v3-spec

- name: Check for changes
id: diff
run: |
if git diff --quiet assets/acquia-v3-spec.yaml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Create PR if spec changed
if: steps.diff.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="automated/update-acquia-v3-spec-${{ github.run_id }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add assets/acquia-v3-spec.yaml
git commit -m "chore: update Acquia v3 OpenAPI spec"
git push origin "$BRANCH"
gh pr create \
--title "chore: update Acquia v3 OpenAPI spec" \
--body "Automated spec update from https://api-specs-dev.dev.cicd.acquia.io/openapi.yaml" \
--label "chore" \
--base main \
--head "$BRANCH"
gh pr merge "$BRANCH" --auto --squash
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,7 @@
"git -C var/cx-api-spec rev-parse HEAD > assets/acquia-spec.version"
],
"update-acquia-v3-spec": [
"rm -rf var/api-specs",
"git clone --depth 1 git@github.com:acquia/api-specs.git var/api-specs",
"npm install --prefix var/api-specs @redocly/cli@latest --no-save --ignore-scripts",
"cd var/api-specs && PATH=$(pwd)/node_modules/.bin:$PATH make bundle",
"cd var/api-specs && npx --yes @redocly/cli@latest bundle --config redocly.bundle.yaml dist/openapi.yaml --dereferenced --ext json -o ../../assets/acquia-v3-spec.json",
"git -C var/api-specs rev-parse HEAD > assets/acquia-v3-spec.version",
"rm -rf var/api-specs"
"curl -sfL https://api-specs-dev.dev.cicd.acquia.io/openapi.yaml -o assets/acquia-v3-spec.yaml"
],
"update-acsf-api-spec": [
"rm -rf gardener",
Expand Down
Loading