Update API specs #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update API specs | |
on: | |
workflow_dispatch: | |
# Run daily after midnight UTC | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
update-api-specs: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Determine base version | |
id: base_version | |
run: | | |
echo "value=$(cat .base_version)" >> "$GITHUB_OUTPUT" | |
- name: Set up Anbox Cloud | |
uses: canonical/anbox-cloud-github-action@ef27ae90bda26fcdb2d33cddcb527ec32f3adc6e | |
with: | |
channel: ${{ steps.base_version.outputs.value }}/stable | |
- name: Determine appliance version | |
id: snap_version | |
run: | | |
echo "value=$(snap info anbox-cloud-appliance | awk '/installed/{print $2}')" >> "$GITHUB_OUTPUT" | |
- name: Extract API spec from AMS | |
run: | | |
sudo apt update | |
sudo apt install -y jq yq | |
# Don't allow us to succeed if the actual curl command fails | |
set -o pipefail | |
curl \ | |
--unix-socket /var/snap/anbox-cloud-appliance/common/ams-unix.socket \ | |
s/1.0/swagger.json | yq -y > ./reference/api-reference/ams-api.yaml | |
sudo curl \ | |
--unix-socket /var/snap/anbox-cloud-appliance/common/gateway/internal.sock \ | |
s/1.0/swagger.json | yq -y > ./reference/api-reference/gateway-api.yaml | |
- name: Create PR | |
uses: canonical/create-pull-request@8f6ac18065716982f3970ef7d6d584bed1b4cbe3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "feat: update API specs from ${{ steps.snap_version.outputs.value }}" | |
branch-name: new-branch | |
title: Update API specs from ${{ steps.snap_version.outputs.value }} | |
body: | | |
This updates the AMS API specification as taken from the `anbox-cloud-appliance` as of | |
version ${{ steps.snap_version.outputs.value }}. | |
You have to close and reopen the PR to trigger checks. | |
repository: canonical/anbox-cloud-docs | |
upsert: true | |
ignore-no-changes: true |