Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Prev Previous commit
Next Next commit
Add test workflow
  • Loading branch information
EdwardAngert committed Apr 9, 2025
commit 6a7a2bc7e73b0964aad6699fdaaa6ba6afd05b1c
72 changes: 72 additions & 0 deletions .github/workflows/test-docs-shared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Docs Shared Example
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'docs/**'
- '**.md'
- '.github/workflows/docs-shared-example.yaml'
- '.github/actions/docs-shared/**'

permissions:
contents: read

jobs:
docs-check:
name: Check Documentation
runs-on: ubuntu-latest
permissions:
pull-requests: write # needed for commenting on PRs
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Get PR info
id: pr_info
run: |
set -euo pipefail
PR_NUMBER=${{ github.event.pull_request.number }}
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Process Documentation
id: docs-shared
uses: ./.github/actions/docs-shared
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
docs-dir: docs
include-md-files: "true"
check-links: "true"
lint-markdown: "true"
format-markdown: "true"
generate-preview: "true"
post-comment: "true"
pr-number: "${{ env.PR_NUMBER }}"
fail-on-error: "false" # Set to false for this example to show all checks

- name: Debug Outputs
run: |
echo "Has changes: ${{ steps.docs-shared.outputs.has_changes }}"
echo "Preview URL: ${{ steps.docs-shared.outputs.preview_url }}"
echo "Manifest changed: ${{ steps.docs-shared.outputs.manifest_changed }}"
echo "New docs found: ${{ steps.docs-shared.outputs.has_new_docs }}"

# Only display errors if there are any
if [ "${{ steps.docs-shared.outputs.lint_results }}" != "" ]; then
echo "Linting issues found:"
echo "${{ steps.docs-shared.outputs.lint_results }}"
fi

if [ "${{ steps.docs-shared.outputs.format_results }}" != "" ]; then
echo "Formatting issues found:"
echo "${{ steps.docs-shared.outputs.format_results }}"
fi
Loading