Repository navigation
67 lines (61 loc) · 2.32 KB
/
Copy pathrequest-ref-toc-gen.yml
File metadata and controls
67 lines (61 loc) · 2.32 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
62
63
64
65
66
67
# cSpell:ignore microsoftgraph
name: On-demand reference TOC generation
on:
issue_comment:
types:
- created
permissions:
actions: write
contents: write
issues: write
pull-requests: write
jobs:
get-pull-target:
name: Get pull request head branch
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '#gen-toc') && github.event.issue.state == 'open' }}
outputs:
target: ${{ fromJson(steps.get_pull_request.outputs.data).head.ref }}
steps:
- uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
id: thumbs-up
with:
route: POST /repos/:owner/:repo/issues/comments/:comment/reactions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: ${{ github.event.repository.name }}
INPUT_COMMENT: ${{ github.event.comment.id }}
INPUT_CONTENT: '"+1"'
- uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
id: get_pull_request
with:
route: GET /repos/:owner/:repo/pulls/:pull
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: ${{ github.event.repository.name }}
INPUT_PULL: ${{ github.event.issue.number }}
request-toc-gen:
name: Generate reference TOC
needs: get-pull-target
uses: microsoftgraph/microsoft-graph-docs/.github/workflows/generate-ref-toc.yml@main
with:
target: ${{ needs.get-pull-target.outputs.target }}
pull_request: false
update-pull-request:
name: Update pull request
runs-on: ubuntu-latest
if: ${{ always() && needs.request-toc-gen.result != 'skipped' }}
needs: request-toc-gen
steps:
- uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
id: update-pr
with:
route: POST /repos/:owner/:repo/issues/:pull/comments
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: ${{ github.event.repository.name }}
INPUT_PULL: ${{ github.event.issue.number }}
INPUT_BODY: ${{ needs.request-toc-gen.outputs.result || 'TOC generation did not produce a result. Please check the workflow logs.' }}