8000 Add workflow to dispatch the update of the OpenAPI spec by giograno · Pull Request #11709 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Add workflow to dispatch the update of the OpenAPI spec #11709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/update_openapi_spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update OpenAPI Spec

on:
push:
branches:
- master
paths:
- '**/*openapi.yaml'
- '**/*openapi.yml'
workflow_dispatch:

jobs:
update-openapi-spec:
runs-on: ubuntu-latest

steps:
# This step dispatches a workflow in the OpenAPI repo, updating the spec and opening a PR.
- name: Dispatch update spec workflow
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PRO_ACCESS_TOKEN }}
repository: localstack/openapi
event-type: openapi-update
# A git reference is needed when we want to dispatch the worflow from another branch.
client-payload: '{"ref": "${{ github.ref }}", "repo": "${{ github.repository }}"}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this really about handing over the reg and repo here? This would mean that if you trigger this manually from another branch, the specs would be taken from another branch, updating the specs in the repo with a non-merged version.
Is this what we want? What would this be used for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair observation. I added the ref to the branch and the workflow_dispatch to be able to test the workflow from some spec changes sitting in a branch.
In my view, this workflow should be dispatched only when a spec change is pushed on master. Mostly for testing purposes, it could be handy to have the chance to trigger it from another branch, but I can't come up with concrete examples right now. The spec won't be automatically updated anyway: a PR would still have to be approved and merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right that makes sense! The additional barrier with the PR is great and should definitely be enough!
Would you mind adding a comment to the client-payload? I feel like this isn't obvious and might make sense to add a comment here?

1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ repos:
hooks:
- id: openapi-spec-validator
files: .*openapi.*\.(json|yaml|yml)
exclude: ^(tests/|.github/workflows/)
Loading
0