-
Notifications
You must be signed in to change notification settings - Fork 550
misc: Added Github Actions for linting and building api specs #6720
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
5 commits
Select commit
Hold shift + click to select a range
51043bb
Added action to check for linting errors in openapi.yaml
akshatsinha007 3f4baf4
Create build-docs.yaml
akshatsinha007 458d82a
added read-only permission in api-linter
akshatsinha007 6fb25e4
updated action to add permission
akshatsinha007 03f519e
Merge branch 'main' into openapi-actions
akshatsinha007 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,26 @@ | ||
name: Lint API Specs | ||
on: | ||
pull_request: | ||
paths: | ||
- 'specs/swagger/**' | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
- name: Install Redocly CLI | ||
run: npm install -g @redocly/cli | ||
- name: Lint OpenAPI specification | ||
run: | | ||
cd specs/swagger | ||
echo "Linting OpenAPI specification..." | ||
redocly lint openapi.yaml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} | ||
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,55 @@ | ||
name: OpenAPI Build Documentation | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'specs/swagger/**' | ||
permissions: | ||
contents: write | ||
jobs: | ||
lint-and-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Install Redocly CLI | ||
run: npm install -g @redocly/cli | ||
|
||
- name: Switch to gh-pages branch | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
echo "Switching to gh-pages branch..." | ||
git checkout -b gh-pages | ||
git fetch origin gh-pages | ||
git pull --rebase origin gh-pages | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} | ||
- name: Build OpenAPI documentation | ||
run: | | ||
cd specs/swagger | ||
echo "Building OpenAPI documentation..." | ||
redocly build-docs openapi.yaml --output=openapi.html | ||
echo "Documentation built successfully!" | ||
|
||
- name: Commit and push documentation | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
echo "Committing and pushing documentation..." | ||
git add specs/swagger/openapi.html | ||
if git diff --staged --quiet; then | ||
echo "No changes to commit" | ||
else | ||
git commit -m "Update OpenAPI documentation from main branch" | ||
git push --force origin gh-pages | ||
echo "Documentation pushed to gh-pages branch!" | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }} |
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.
Uh oh!
There was an error while loading. Please reload this page.