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

ci: generate docs & Open API dont fail if no changes to push #178

Merged
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
18 changes: 16 additions & 2 deletions .github/disabled_workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,23 @@ jobs:
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add api-docs-spotify-electron.html
git commit -m "docs : Update API documentation"
if git commit -m "docs : Update API documentation"; then
echo "CHANGES=true" >> $GITHUB_ENV
else
echo "No changes to commit"
echo "CHANGES=false" >> $GITHUB_ENV
fi

- name: Pushing to the protected branch 'protected'
- name: Check if there are changes to push
id: check_changes
run: |
if [ "$CHANGES" == "true" ]; then
echo "Changes detected"
else
echo "No changes detected"
fi

- name: Pushing to the protected branch 'master'
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.PAT }}
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/generate-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,14 @@ jobs:
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add openapi.json
git commit -m "docs: Update OpenAPI Schema" || echo "No changes to commit"

- name: Check if there are changes to push
id: check_changes
working-directory: Electron/src/swagger/
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "CHANGES=false" >> $GITHUB_ENV
else
if git commit -m "docs: Update OpenAPI Schema"; then
echo "CHANGES=true" >> $GITHUB_ENV
else
echo "No changes to commit"
echo "CHANGES=false" >> $GITHUB_ENV
fi

- name: Pushing to the protected branch 'protected'
- name: Pushing to the protected branch 'master'
if: env.CHANGES == 'true'
uses: CasperWA/push-protected@v2
with:
Expand Down