Skip to content

Commit

Permalink
Expose branch name for scheduled docs validation (#435)
Browse files Browse the repository at this point in the history
$GITHUB_BASE_REF is not available for the scheduled or manually launched
workflows
  • Loading branch information
fantkolja authored Jan 23, 2025
1 parent aaabca1 commit 6818e95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions .github/actions/validate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ inputs:
description: Log level parameter (--log-level) for load-check-links-playbook
required: false
default: log
SLACK_WEBHOOK_URL:
repository-name:
description: Repository name used by load-check-links-playbook.js
required: false
default: ${{ github.repository }}
base-branch-name:
description: Branch name used by load-check-links-playbook.js
required: false
default: ${{ github.base_ref }}
slack-webhook-url:
description: Secret for a Slack webhook to show failed notifications
required: false
default: ''
Expand Down Expand Up @@ -42,7 +50,7 @@ runs:
run: |
npm i
npm i -D hazelcast/hazelcast-docs-tools#v1.1.0 [email protected] [email protected]
./node_modules/.bin/load-check-links-playbook -r $GITHUB_REPOSITORY -b $GITHUB_BASE_REF --log-level ${{ inputs.check-links-loader-log-level }}
./node_modules/.bin/load-check-links-playbook -r ${{ inputs.repository-name }} -b ${{ inputs.base-branch-name }} --log-level ${{ inputs.check-links-loader-log-level }}
./node_modules/.bin/antora --fetch --to-dir test --log-level=warn --log-failure-level=warn --extension=./node_modules/hazelcast-docs-tools/antora-extensions/antora-link-checker-extension.js check-links-playbook.yml
- name: Check orphan pages
Expand All @@ -51,11 +59,11 @@ runs:

- name: Slack notification
uses: 8398a7/action-slack@v3
if: failure() && inputs.SLACK_WEBHOOK_URL != ''
if: failure() && inputs.slack-webhook-url != ''
with:
status: failure
fields: repo,job,workflow
text: "👎 Validate docs failed - ⛓️‍💥 broken internal links or ASCIIDOC syntax errors found ⛓️‍💥."
channel: "#docs-notifications"
env:
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ inputs.slack-webhook-url }}
3 changes: 2 additions & 1 deletion .github/workflows/validate-docs-on-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ jobs:
uses: ./.github/actions/validate
with:
orphan-checker-directory: tutorials
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DOCS }}
base-branch-name: main
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_DOCS }}

0 comments on commit 6818e95

Please sign in to comment.