Uh oh!
There was an error while loading. Please reload this page.
Implement GitHub Actions workflow for automatically updating the example JSON files - #2068
Implement GitHub Actions workflow for automatically updating the example JSON files#2068cebe wants to merge 4 commits into
Conversation
webron
left a comment
There was a problem hiding this comment.
Huh, this is awesome. Would it make sense to change the Action to run on *.yaml in that directory instead?
| push: | ||
| branches: | ||
| - master | ||
| - try-github-actions |
There was a problem hiding this comment.
probably not, going to remove that before merging this PR. But it will run the action if I make adjustments to this branch so I'd keep it for testing until it is ready to merge.
cebe
commented
Nov 27, 2019
what do you mean? As far as I am aware there is no way to run an action based on whether some files changed or not. |
cebe
commented
Dec 4, 2019
@webron is there anything to change or to do from my side to get this merged? (except from removing the |
webron
commented
Dec 4, 2019
Sorry, I didn't mean run it based on whether a file changed, but rather here: instead of running it on each file individually, it'd be more robust if it ran on all yaml file in the directory, in case additional files are added. |
MikeRalphson
commented
Dec 5, 2019
Also, what indentation is used in the output json? I guess it should match the v2.0 examples for consistency. |
cebe
commented
Dec 5, 2019
Indentation is currently 4 spaces, I'll change that to 2. |
MikeRalphson
commented
Dec 5, 2019
cebe
commented
Dec 5, 2019
yes, symfony/yaml has some problems with these files, did not see that PR, will try to merge the commit and see if it fixes the problem.
sure I can do that. |
This workflow updates the *.json files in the examples/v3.0 directory, when the corresponding *.yaml files change. JSON example files are automatically generated from the YAML example files. Only the YAML files should be adjusted manually. fixesOAI#1385 - When a push to `master` (or any other branch we wish to include) is made, a Github Actions Workflow is triggered ([example](https://github.com/cebe/OpenAPI-Specification/commit/9c98e819ae876af92c2a9112dcfa6dfcb929e7dc/checks?check_suite_id=331067708)) - it will generate new JSON files from the YAML examples - if there are any changes, it will create a pull request to the branch that triggered the Workflow ([example](#3))
cebe
commented
Dec 6, 2019
Merged the changes from #2036, they fix the issue with api-with-examples.yaml.
done.
indentation is 2 now. Ready to merge from my side. |
webron
left a comment
There was a problem hiding this comment.
I'm ok with the changes. @MikeRalphson please verify as well. If It's all good, we need to remove the test branch from the script and then merge it.
MikeRalphson
commented
Dec 8, 2019
My only question is why we indent the target with tabs and then (presumably) overwrite it with a space indented version. Otherwise LGTM. |
cebe
commented
Dec 9, 2019
The tool I use for indentation can not convert 4 space to 2 space indentation. it can only convert tabs to spaces or spaces to tabs. So I do the conversion in two steps, 4 spaces to tabs, then tabs to 2 spaces. |
cebe
commented
Dec 9, 2019
done. |
MikeRalphson
commented
Dec 9, 2019
@webron are you ok to create the |
webron
commented
Dec 10, 2019
@MikeRalphson If I understand correctly, |
MikeRalphson
commented
Dec 10, 2019
👍 |
cebe
commented
Dec 23, 2019
there is no need to add a github token manually, it is provided by Github actions. Anything stopping this from being merged? |
cebe
commented
May 27, 2020
Closing this, as #2199 is replacing it. |
As discussed in #1385 the example
.jsonfiles for version 3 should be automatically generated from the.yamlexample files.I thought this was a good case for trying out Github Actions and the result is the following:
master(or any other branch we wish to include) is made, a Github Actions Workflow is triggered (example)