8000 Add test workflow · coder/coder@6a7a2bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a7a2bc

Browse files
committed
Add test workflow
1 parent 07e93b0 commit 6a7a2bc

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docs Shared Example
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
paths:
6+
- 'docs/**'
7+
- '**.md'
8+
- '.github/workflows/docs-shared-example.yaml'
9+
- '.github/actions/docs-shared/**'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
docs-check:
16+
name: Check Documentation
17+
runs-on: ubuntu-latest
18+
permissions:
19+
pull-requests: write # needed for commenting on PRs
20+
steps:
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
23+
with:
24+
egress-policy: audit
25+
26+
- name: Checkout
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Get PR info
32+
id: pr_info
33+
run: |
34+
set -euo pipefail
35+
PR_NUMBER=${{ github.event.pull_request.number }}
36+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
37+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Process Documentation
42+
id: docs-shared
43+
uses: ./.github/actions/docs-shared
44+
with:
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
docs-dir: docs
47+
include-md-files: "true"
48+
check-links: "true"
49+
lint-markdown: "true"
50+
format-markdown: "true"
51+
generate-preview: "true"
52+
post-comment: "true"
53+
pr-number: "${{ env.PR_NUMBER }}"
54+
fail-on-error: "false" # Set to false for this example to show all checks
55+
56+
- name: Debug Outputs
57+
run: |
58+
echo "Has changes: ${{ steps.docs-shared.outputs.has_changes }}"
59+
echo "Preview URL: ${{ steps.docs-shared.outputs.preview_url }}"
60+
echo "Manifest changed: ${{ steps.docs-shared.outputs.manifest_changed }}"
61+
echo "New docs found: ${{ steps.docs-shared.outputs.has_new_docs }}"
62+
63+
# Only display errors if there are any
64+
if [ "${{ steps.docs-shared.outputs.lint_results }}" != "" ]; then
65+
echo "Linting issues found:"
66+
echo "${{ steps.docs-shared.outputs.lint_results }}"
67+
fi
68+
69+
if [ "${{ steps.docs-shared.outputs.format_results }}" != "" ]; then
70+
echo "Formatting issues found:"
71+
echo "${{ steps.docs-shared.outputs.format_results }}"
72+
fi

0 commit comments

Comments
 (0)
0