Skip to content

Commit 8bd8004

Browse files
committed
fixup! feat(docs): add workflow to generate documentation on PR merge
1 parent 8ccbae5 commit 8bd8004

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.github/workflows/check-and-gen.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Check and Generate
33
on:
44
pull_request:
55
push:
6-
branches:
6+
branches-ignore:
77
- master
88
- release/*
99
workflow_dispatch:
@@ -71,7 +71,7 @@ jobs:
7171
generate-docs:
7272
name: Generate Documentation
7373
runs-on: ubuntu-latest
74-
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/releases' && !startsWith(github.ref, 'refs/heads/release/'))
74+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/'))
7575
permissions:
7676
contents: write
7777
steps:
@@ -92,14 +92,17 @@ jobs:
9292
}
9393
9494
- name: Commit and push if documentation changed
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9597
run: |
9698
if [ -n "$(git status --porcelain)" ]; then
97-
# Bot email is configured from: https://github.com/orgs/community/discussions/26560
99+
# Bot email is configured from: https://github.com/orgs/community/discussions/26560
98100
git config user.name "github-actions[bot]"
99101
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
100102
git add .
101103
git commit -m "docs: update API documentation via docsgen-cli"
102-
git push
104+
BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
105+
git push origin HEAD:$BRANCH_NAME
103106
else
104107
echo "No documentation changes to commit"
105-
fi
108+
fi

0 commit comments

Comments
 (0)