Skip to content

Sync

Sync #49

Workflow file for this run

name: Sync
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
contents: write
pull-requests: write
checks: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache-dependency-path: |
./go.sum
_tools/go.sum
- name: Go version
run: go version
- name: Install Swagger binary
run: |
bin/deps.sh github.com/go-swagger/go-swagger/cmd/swagger
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Regenerate Swagger code
id: swagger
run: |
REVISION=$(curl -s https://app.firehydrant.io/infra/health | jq -r .revision)
set -x
echo "REVISION=${REVISION}" >> "$GITHUB_OUTPUT"
bin/update-swagger-doc.sh
bin/regenerate.sh
- name: Commit changes
run: |
api_server_revision="${{ steps.swagger.outputs.REVISION }}"
branch="swagger/${api_server_revision}"
set -x
git checkout -b "${branch}"
git config --global user.email "[email protected]"
git config --global user.name "FireHydrant Bot"
git add .
# If there are no changes, exit 0 and don't push
git commit -m "Regenerate Swagger code ${api_server_revision}" || exit 0
git push -u origin "${branch}"
gh pr create \
--title "Regenerate Swagger code \`${api_server_revision}\`" \
--body "https://github.com/firehydrant/laddertruck/commits/${api_server_revision}" \
--base main \
--head "${branch}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}