Skip to content

Commit 5954aec

Browse files
committed
fixup! feat(docs): add workflow to generate documentation on PR merge
1 parent a5ef2e2 commit 5954aec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1919

2020
permissions:
21-
contents: read
21+
contents: write
2222

2323
jobs:
2424
check-gen:
@@ -110,20 +110,18 @@ jobs:
110110
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
111111
git add .
112112
git commit -m "docs: update API documentation via docsgen-cli"
113-
BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
114-
git push origin HEAD:$BRANCH_NAME
113+
BRANCH_NAME=$(echo $GITHUB_HEAD_REF | sed 's/refs\/heads\///')
114+
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.actor }}/lotus.git HEAD:$BRANCH_NAME
115115
116116
- name: Comment on the pull request
117117
if: steps.check_changes.outputs.changes == 'true'
118118
uses: actions/github-script@v6
119119
with:
120120
github-token: ${{ secrets.GITHUB_TOKEN }}
121121
script: |
122-
const { context } = require('@actions/github');
123-
const prNumber = context.payload.pull_request.number;
124122
const comment = 'CLI documentation has been generated and pushed to the branch.';
125123
await github.issues.createComment({
126124
...context.repo,
127-
issue_number: prNumber,
125+
issue_number: context.payload.pull_request.number,
128126
body: comment
129127
});

0 commit comments

Comments
 (0)