Skip to content

Commit 34fcfbe

Browse files
authored
Merge pull request #2578 from 89luca89/main
ci: add job to detect PRs that need docs update
2 parents a211a30 + 9d8b6d2 commit 34fcfbe

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/check-docs.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Check Docs
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
8+
check_changes:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
docs_changes: ${{ steps.check_file_changed.outputs.changed }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
# Checkout as many commits as needed for the diff
16+
fetch-depth: 2
17+
18+
# Generate docs
19+
# Return true/false if docs are changed
20+
- id: check_file_changed
21+
run: |
22+
./gendocs.sh
23+
if git diff --name-only | grep -E "^docs|devspace-schema.json"; then
24+
echo "{changed}={True}" >> $GITHUB_OUTPUT
25+
else
26+
echo "{changed}={False}" >> $GITHUB_OUTPUT
27+
fi
28+
29+
30+
31+
check-docs:
32+
runs-on: ubuntu-latest
33+
needs: check_changes
34+
if: needs.check_changes.outputs.docs_changes == 'True'
35+
permissions:
36+
pull-requests: write
37+
steps:
38+
- uses: mshick/add-pr-comment@v2
39+
with:
40+
allow-repeats: true
41+
message: |
42+
**Docs Update Needed!**
43+
It seems like you need to run `gendocs.sh` in order to update the docs.
44+
Please run this command and commit before merging.
45+
Thanks!

gendocs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -o errexit
4+
set -o nounset
5+
6+
go run ./docs/hack/cli/main.go
7+
go run ./docs/hack/config/partials/main.go
8+
go run ./docs/hack/config/schemas/main.go

0 commit comments

Comments
 (0)