Skip to content
Merged
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
110 changes: 10 additions & 100 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
@@ -1,111 +1,21 @@
name: Documentation Quality Check

# Thin caller for the documentation CI orchestrator in gardenlinux/docs.
#
# All documentation-path logic and the notify/commit-lock decision live in
# gardenlinux/docs/.github/workflows/aggregated-repo-docs.yml, which uses
# repos-config.json as the single source of truth for documentation paths.

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, closed]
# No paths: filter — must run on every PR to always produce the gate check
push:
branches: [main]
paths:
- 'docs/**'

jobs:
detect-changes:
name: Detect docs path changes
# Skip on closed PRs (only need the notification) and push events (handled by paths: above)
if: github.event_name != 'pull_request' || github.event.action != 'closed'
runs-on: ubuntu-24.04
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
- name: Check for docs path changes
id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
filters: |
docs:
- 'docs/**'

docs-checks:
needs: [detect-changes]
if: needs.detect-changes.outputs.docs == 'true'
uses: gardenlinux/docs/.github/workflows/docs-checks.yml@main
docs:
uses: gardenlinux/docs/.github/workflows/aggregated-repo-docs.yml@main
with:
override-repo: ${{ github.event.repository.name }}
override-ref: ${{ github.head_ref || github.ref_name }}
override-commit: ${{ github.event.pull_request.head.sha || github.sha }}

docs-checks-gate:
name: Docs checks gate
needs: [detect-changes, docs-checks]
if: always() && (github.event_name != 'pull_request' || github.event.action != 'closed')
runs-on: ubuntu-24.04
steps:
- name: Evaluate docs checks result
run: |
DOCS_CHANGED="${{ needs.detect-changes.outputs.docs }}"
DOCS_RESULT="${{ needs.docs-checks.result }}"
if [[ "$DOCS_CHANGED" != "true" ]]; then
echo "Docs paths not changed; skipping docs checks — gate passes."
exit 0
fi
if [[ "$DOCS_RESULT" == "success" ]]; then
echo "Docs checks passed."
exit 0
fi
echo "Docs checks result: $DOCS_RESULT"
exit 1

notify-docs:
name: Notify docs
needs: [docs-checks]
runs-on: ubuntu-24.04
# Only notify for PR events (not push events which lack PR context)
# Run after checks pass for open PRs, OR immediately for merged PRs
if: |
always() &&
github.event_name == 'pull_request' &&
(
(github.event.action == 'closed' && github.event.pull_request.merged == true) ||
(github.event.action != 'closed' && needs.docs-checks.result == 'success')
)
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
private-key: ${{ secrets.DOCS_BOT_PRIVATE_KEY }}
repositories: docs

- name: Send repository dispatch to docs
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const isMergedPR = context.payload.action === 'closed' &&
context.payload.pull_request.merged === true;

// For merged PRs, use the base branch (the branch it was merged into)
// For open PRs, use the head branch (feature branch)
const ref = isMergedPR
? context.payload.pull_request.base.ref
: context.payload.pull_request.head.ref;

await github.rest.repos.createDispatchEvent({
owner: 'gardenlinux',
repo: 'docs',
event_type: 'docs-pr',
client_payload: {
repo: '${{ github.event.repository.name }}',
pr_number: `${context.payload.pull_request.number}`,
commit_sha: isMergedPR
? context.payload.pull_request.merge_commit_sha
: context.payload.pull_request.head.sha,
ref: ref,
event: isMergedPR ? 'merged' : 'pr_success'
}
});
core.info('Repository dispatch sent to docs');
repo: glrd
secrets: inherit
Loading