forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.73 KB
/
docs-verifier-tryfix.yml
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
name: MSDocs build verifier - tryfix
on:
issue_comment:
types: [created]
jobs:
tryfix:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/tryfix')
name: Try fix build
runs-on: ubuntu-latest
permissions: write-all
env:
IS_TRY_FIX: true # differentiates /tryfix from the validation-only run.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Checkout the repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Checkout Pull Request
run: |
hub pr checkout ${{ github.event.issue.number }}
- name: Tryfix
uses: dotnet/docs-actions/actions/docs-verifier@main
- name: Push changes
run: |
git config --global user.name github-actions
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add fork https://github.com/${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
git commit -am "Automated: Fix links"
git push -u fork ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}