-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.62 KB
/
update-docs-submodule.yml
File metadata and controls
61 lines (52 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Update Docs Submodule
on:
repository_dispatch:
types: [docs-updated]
workflow_dispatch:
inputs:
reason:
description: 'Reason for manual trigger'
required: false
default: 'Manual update'
permissions:
contents: write
jobs:
update-submodule:
runs-on: ubuntu-latest
# Requires manual approval - configure "production" environment in repo settings
# Settings > Environments > New environment > "production" > Add reviewers
environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Update docs submodule
run: |
cd docs
git fetch origin main
git checkout origin/main
cd ..
- name: Check for changes
id: check
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Changes detected in docs submodule"
fi
- name: Commit and push
if: steps.check.outputs.changed == 'true'
run: |
git add docs
git commit -m "chore: update docs submodule to latest
Triggered by: ${{ github.event_name }}
${{ github.event.client_payload.message || inputs.reason || '' }}"
git push