Skip to content

Commit

Permalink
Skip documentation jobs if discourse credentials are not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
arturo-seijas committed Nov 5, 2024
1 parent f37e30d commit aeca886
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/promote_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,12 @@ jobs:
- name: Search for docs folder
id: docs-exist
run: echo "docs_exist=$([[ -d docs ]] && echo 'True' || echo 'False')" >> $GITHUB_OUTPUT
- name: "Export DISCOURSE_API_USERNAME and DISCOURSE_API_KEY"
env:
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
discourse_api_key: ${{ secrets.DISCOURSE_API_KEY }}
- name: Publish documentation
if: steps.docs-exist.outputs.docs_exist == 'True'
if: steps.docs-exist.outputs.docs_exist == 'True' && ${{ env.discourse_api_username != '' }} && ${{ env.discourse_api_key != '' }}
uses: canonical/discourse-gatekeeper@stable
with:
discourse_host: discourse.charmhub.io
Expand All @@ -209,8 +213,12 @@ jobs:
- name: Search for docs folder
id: docs-exist
run: echo "docs_exist=$([[ -d docs ]] && echo 'True' || echo 'False')" >> $GITHUB_OUTPUT
- name: "Export DISCOURSE_API_USERNAME and DISCOURSE_API_KEY"
env:
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
discourse_api_key: ${{ secrets.DISCOURSE_API_KEY }}
- name: Publish documentation
if: steps.docs-exist.outputs.docs_exist == 'True'
if: steps.docs-exist.outputs.docs_exist == 'True' && ${{ env.discourse_api_username != '' }} && ${{ env.discourse_api_key != '' }}
uses: canonical/discourse-gatekeeper@stable
id: publishDocumentation
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/publish_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ jobs:
- name: Search for docs folder
id: docs-exist
run: echo "docs_exist=$([[ -d docs ]] && echo 'True' || echo 'False')" >> $GITHUB_OUTPUT
- name: "Export DISCOURSE_API_USERNAME and DISCOURSE_API_KEY"
env:
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
discourse_api_key: ${{ secrets.DISCOURSE_API_KEY }}
- name: Publish documentation
if: steps.docs-exist.outputs.docs_exist == 'True'
uses: canonical/discourse-gatekeeper@stable
uses: canonical/discourse-gatekeeper@stable && ${{ env.discourse_api_username != '' }} && ${{ env.discourse_api_key != '' }}
with:
discourse_host: discourse.charmhub.io
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,13 @@ jobs:
- name: Search for docs folder
id: docs-exist
run: echo "docs_exist=$([[ -d docs ]] && echo 'True' || echo 'False')" >> $GITHUB_OUTPUT
- name: "Export DISCOURSE_API_USERNAME and DISCOURSE_API_KEY"
env:
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
discourse_api_key: ${{ secrets.DISCOURSE_API_KEY }}
- name: Publish documentation
if: ${{ steps.docs-exist.outputs.docs_exist == 'True' && !github.event.pull_request.head.repo.fork }}
uses: canonical/discourse-gatekeeper@stable
uses: canonical/discourse-gatekeeper@stable && ${{ env.discourse_api_username != '' }} && ${{ env.discourse_api_key != '' }}
with:
discourse_host: discourse.charmhub.io
discourse_api_username: ${{ secrets.DISCOURSE_API_USERNAME }}
Expand Down

0 comments on commit aeca886

Please sign in to comment.