-
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.33 KB
/
Copy pathon-push-do-docs.yml
File metadata and controls
46 lines (39 loc) · 1.33 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
name: on-push-do-docs
on:
push:
# Branches only: a tag push has no branch to commit regenerated docs to. Dependabot branches
# are skipped since their bumps do not change docs, and a docs commit would restart the PR build.
branches:
- '**'
- '!dependabot/**'
# Serialize per branch, so two quick pushes do not race each other's docs commit.
concurrency:
group: docs-${{ github.ref }}
permissions:
contents: write
jobs:
docs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Run MarkdownSnippets
shell: bash
run: |
dotnet tool install --global MarkdownSnippets.Tool
mdsnippets "$GITHUB_WORKSPACE"
# Fails the run when the push is rejected rather than hiding it. A push made with
# GITHUB_TOKEN does not trigger further workflow runs, so this does not rebuild the branch.
- name: Push changes
shell: bash
run: |
if git diff --quiet; then
echo "No docs changes"
exit 0
fi
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "Docs changes" -a
git push origin "HEAD:$GITHUB_REF_NAME"