From df2348a14fa6df510d6a36c7b5481899407c90de Mon Sep 17 00:00:00 2001 From: Eike Waldt Date: Wed, 9 Sep 2026 12:24:01 +0200 Subject: [PATCH] docs: add docs-check workflow Signed-off-by: Eike Waldt On-behalf-of: SAP --- .github/workflows/docs-check.yml | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/docs-check.yml diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml new file mode 100644 index 0000000..9e318cb --- /dev/null +++ b/.github/workflows/docs-check.yml @@ -0,0 +1,80 @@ +name: Documentation Quality Check + +on: + pull_request: + branches: [gh-pages] + types: [opened, synchronize, reopened, closed] + paths: + - "docs/**" + - ".github/workflows/docs-check.yml" + - "README.md" + - "DEVELOPER.md" + push: + branches: [gh-pages] + paths: + - "docs/**" + - ".github/workflows/docs-check.yml" + - "README.md" + - "DEVELOPER.md" + +jobs: + docs-checks: + # Skip checks on closed PRs (only need the notification) + if: github.event_name != 'pull_request' || github.event.action != 'closed' + uses: gardenlinux/docs/.github/workflows/docs-checks.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 }} + + 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');