Skip to content

Commit cc189cd

Browse files
Update scripts
1 parent 6bb3b81 commit cc189cd

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

.github/workflows/windows-test.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ jobs:
1515
with:
1616
github-token: ${{ secrets.GITHUB_TOKEN }}
1717
script: |
18-
github.repos.createStatus({
19-
owner: context.repo.owner,
20-
repo: context.repo.repo,
21-
sha: context.payload.client_payload.pull_request.head.sha,
22-
state: 'pending',
23-
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
24-
context: 'Test Windows',
25-
})
18+
async ({ github, context }) => {
19+
await github.rest.repos.createCommitStatus({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
sha: context.payload.client_payload.pull_request.head.sha,
23+
state: 'pending',
24+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
25+
context: 'Test Windows',
26+
});
27+
}
2628
2729
- name: Checkout
2830
uses: actions/checkout@v4
@@ -46,28 +48,32 @@ jobs:
4648
uses: actions/[email protected]
4749
if: success()
4850
with:
49-
github-token: ${{secrets.GITHUB_TOKEN}}
51+
github-token: ${{ secrets.GITHUB_TOKEN }}
5052
script: |
51-
github.repos.createStatus({
52-
owner: context.repo.owner,
53-
repo: context.repo.repo,
54-
sha: context.payload.client_payload.pull_request.head.sha,
55-
state: 'success',
56-
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
57-
context: 'Test Windows',
58-
})
53+
async ({ github, context }) => {
54+
await github.rest.repos.createCommitStatus({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
sha: context.payload.client_payload.pull_request.head.sha,
58+
state: 'success',
59+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
60+
context: 'Test Windows',
61+
});
62+
}
5963
6064
- name: Create failure status
6165
uses: actions/[email protected]
6266
if: failure()
6367
with:
64-
github-token: ${{secrets.GITHUB_TOKEN}}
68+
github-token: ${{ secrets.GITHUB_TOKEN }}
6569
script: |
66-
github.repos.createStatus({
67-
owner: context.repo.owner,
68-
repo: context.repo.repo,
69-
sha: context.payload.client_payload.pull_request.head.sha,
70-
state: 'failure',
71-
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
72-
context: 'Test Windows',
73-
})
70+
async ({ github, context }) => {
71+
await github.rest.repos.createCommitStatus({
72+
owner: context.repo.owner,
73+
repo: context.repo.repo,
74+
sha: context.payload.client_payload.pull_request.head.sha,
75+
state: 'failure',
76+
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
77+
context: 'Test Windows',
78+
});
79+
}

0 commit comments

Comments
 (0)