Skip to content

OSCER-496: Enforce CE determination_data with value objects #790

OSCER-496: Enforce CE determination_data with value objects

OSCER-496: Enforce CE determination_data with value objects #790

# Update OpenAPI docs so that they remain up to date with the application
name: Update OpenAPI Docs
on:
pull_request:
paths:
- reporting-app/**
- Makefile
- .github/workflows/ci-reporting-app-openapi.yml
defaults:
run:
working-directory: ./reporting-app
# Only trigger run one update of the OpenAPI spec at a time on the branch.
# If new commits are pushed to the branch, cancel in progress runs and start
# a new one.
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
update-openapi-docs:
runs-on: ubuntu-latest
env:
# Pass through env so shell steps are not script-injection vectors (github.head_ref in run:)
HEAD_REF: ${{ github.head_ref }}
steps:
- uses: actions/checkout@v6
with:
# Use PR head SHA so fork PRs work (branch name from head_ref may not exist on upstream)
ref: ${{ github.event.pull_request.head.sha }}
# Detached HEAD at SHA breaks `git push`; recreate the PR branch name at this commit for same-repo PRs
- name: Match branch for git push
run: git checkout -B "$HEAD_REF"
- name: Update OpenAPI spec
run: make .env openapi-spec
- name: Push changes
run: |
git config user.name nava-platform-bot
git config user.email platform-admins@navapbc.com
git add --all
# If there are meaningful changes, commit them. We ignore lines that
# look to reference autogenerated model IDs, as OasRails does not
# produce stable IDs for those
git diff-index \
--quiet HEAD \
--ignore-matching-lines='ref": .*\/[0-9a-z]{32}"$' \
--ignore-matching-lines='[ "'\'']+[0-9a-z]{32}["'\'']*:' \
|| git commit -m "Update OpenAPI spec"
# No upstream after checkout -B; push explicitly (same as push -u origin <branch>)
git push origin "HEAD:refs/heads/${HEAD_REF}"