Skip to content
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

export and auto-commit docs/docs/api/openapi.json as part of test-api-contract workflow #719

Merged
merged 47 commits into from
Jan 14, 2023

Conversation

andrewm4894
Copy link
Collaborator

@andrewm4894 andrewm4894 commented Jan 14, 2023

It seems that an openapi.json is generated and used as part of the test-api-contract workflow. This PR just

  • copies that openapi.json file to docs/docs/api/openapi.json as part of start-mock-server.sh.
  • adds a step to the end of the test-api-contract workflow that just auto-commits changes to the docs/docs/api/openapi.json file.
  • excludes docs/docs/api/openapi.json from pre-commit since its already been formatted by jq.

Here is an example of the commit made by the workflow if the file docs/docs/api/openapi.json changes.

@@ -4,6 +4,7 @@ on:
push:
branches:
- main
- add-api-docs-workflow
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if/once we happy to merge i will make a final commit to this PR to remove this branch - just needed as part of testing this PR.

@github-actions
Copy link

pre-commit failed.
Please run pre-commit run --all-files locally and commit the changes.
Find more information in the repository's CONTRIBUTING.md


- uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: "docs/docs/api/openapi.json"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this ensures will only ever auto-commit for the docs/docs/api/openapi.json file to reduce risk of any other files accidentally getting autocommited for whatever reason.

@github-actions
Copy link

pre-commit failed.
Please run pre-commit run --all-files locally and commit the changes.
Find more information in the repository's CONTRIBUTING.md

@andrewm4894 andrewm4894 marked this pull request as ready for review January 14, 2023 21:35
@github-actions
Copy link

pre-commit failed.
Please run pre-commit run --all-files locally and commit the changes.
Find more information in the repository's CONTRIBUTING.md

@yk
Copy link
Collaborator

yk commented Jan 14, 2023

what happens if the file remains unchanged? no commit?

@andrewm4894
Copy link
Collaborator Author

what happens if the file remains unchanged? no commit?

yep no commit.

just need to make the openapi.json file pretty so pre-commit wont freak out and fail next time anyone makes a PR. last commit hopefully sorts that - just doing last few checks.

@github-actions
Copy link

pre-commit failed.
Please run pre-commit run --all-files locally and commit the changes.
Find more information in the repository's CONTRIBUTING.md

@andrewm4894 andrewm4894 marked this pull request as ready for review January 14, 2023 22:17
@andrewm4894
Copy link
Collaborator Author

pre-commit just complaining about this:
Uploading image.png…

Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

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

we can also include openapi.json from pre-commit. it's auto-generated, so the formatting is fixed

@andrewm4894
Copy link
Collaborator Author

we can also include openapi.json from pre-commit. it's auto-generated, so the formatting is fixed

going to see if can just run pre-commit on the file as part of the script and be done with it that way. If fails then yep - i might add it to the exclude in the pre-commit yaml.

@andrewm4894 andrewm4894 marked this pull request as draft January 14, 2023 22:33
@github-actions
Copy link

pre-commit failed.
Please run pre-commit run --all-files locally and commit the changes.
Find more information in the repository's CONTRIBUTING.md

@andrewm4894 andrewm4894 marked this pull request as ready for review January 14, 2023 22:39
@andrewm4894 andrewm4894 enabled auto-merge (squash) January 14, 2023 22:40
@andrewm4894 andrewm4894 merged commit 0f607c7 into LAION-AI:main Jan 14, 2023
@andrewm4894 andrewm4894 deleted the add-api-docs-workflow branch January 14, 2023 22:44
@Klotske
Copy link
Contributor

Klotske commented Jan 14, 2023

Seems like this PR broke contract testing...

All the recent merges are failing on stefanzweifel/git-auto-commit-action@v4.

Here's a sample of log with error:
image

@andrewm4894
Copy link
Collaborator Author

ah i think it's hitting some sort of github error relating to the branch protection stuff - i'll make a quick PR to just turn this step off for now while we try figure it out.

@andrewm4894
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants