-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
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 }}"}' | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?