Skip to content

Commit 55d0dfe

Browse files
committed
refactor: use values from event
1 parent 13e93a5 commit 55d0dfe

File tree

1 file changed

+19
-51
lines changed

1 file changed

+19
-51
lines changed

.github/workflows/wiby.yaml

Lines changed: 19 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,17 @@ jobs:
5252

5353
steps:
5454

55-
- name: Load PR
56-
uses: octokit/[email protected]
57-
with:
58-
route: ${{ github.event.pull_request.url }}
59-
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
id: load_pr
62-
63-
- name: Get PR information
64-
run: |
65-
echo "::set-output name=branch::${{ fromJson(steps.load_pr.outputs.data).head.ref }}"
66-
echo "::set-output name=head_sha::${{ fromJson(steps.load_pr.outputs.data).head.sha }}"
67-
echo "::set-output name=repo_name::${{ fromJson(steps.load_pr.outputs.data).base.repo.full_name }}"
68-
echo "::set-output name=repo_url::${{ fromJson(steps.load_pr.outputs.data).base.repo.html_url }}"
69-
id: pr
70-
7155
- name: Set "queued" status
7256
uses: octokit/[email protected]
7357
with:
7458
route: POST /repos/:repository/check-runs
75-
repository: ${{ steps.pr.outputs.repo_name }}
59+
repository: ${{ github.event.repository.full_name }}
7660
mediaType: |
7761
previews:
7862
- antiope
7963
name: ${{ env.WIBY_CHECK_NAME }}
80-
details_url: "${{ steps.pr.outputs.repo_url }}/actions/runs/${{ github.run_id }}"
81-
head_sha: ${{ steps.pr.outputs.head_sha }}
64+
details_url: "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
65+
head_sha: ${{ github.event.pull_request.head.sha }}
8266
status: "queued"
8367
env:
8468
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -87,8 +71,8 @@ jobs:
8771
uses: actions/checkout@v2
8872
with:
8973
token: ${{ secrets.GITHUB_TOKEN }}
90-
repository: ${{ steps.pr.outputs.repo_name }}
91-
ref: ${{ steps.pr.outputs.branch }}
74+
repository: ${{ github.event.repository.full_name }}
75+
ref: ${{ github.event.pull_request.head.ref }}
9276

9377
- name: Prepare Node.js
9478
uses: actions/setup-node@v2
@@ -112,13 +96,13 @@ jobs:
11296
if: ${{ failure() }}
11397
with:
11498
route: POST /repos/:repository/check-runs
115-
repository: ${{ steps.pr.outputs.repo_name }}
99+
repository: ${{ github.event.repository.full_name }}
116100
mediaType: |
117101
previews:
118102
- antiope
119103
name: ${{ env.WIBY_CHECK_NAME }}
120-
details_url: "${{ steps.pr.outputs.repo_url }}/actions/runs/${{ github.run_id }}"
121-
head_sha: ${{ steps.pr.outputs.head_sha }}
104+
details_url: "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
105+
head_sha: ${{ github.event.pull_request.head.sha }}
122106
conclusion: "failure"
123107
env:
124108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -127,13 +111,13 @@ jobs:
127111
uses: octokit/[email protected]
128112
with:
129113
route: POST /repos/:repository/check-runs
130-
repository: ${{ steps.pr.outputs.repo_name }}
114+
repository: ${{ github.event.repository.full_name }}
131115
mediaType: |
132116
previews:
133117
- antiope
134118
name: ${{ env.WIBY_CHECK_NAME }}
135-
details_url: "${{ steps.pr.outputs.repo_url }}/actions/runs/${{ github.run_id }}"
136-
head_sha: ${{ steps.pr.outputs.head_sha }}
119+
details_url: "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
120+
head_sha: ${{ github.event.pull_request.head.sha }}
137121
status: "in_progress"
138122
env:
139123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -148,28 +132,12 @@ jobs:
148132

149133
steps:
150134

151-
- name: Load PR
152-
uses: octokit/[email protected]
153-
with:
154-
route: ${{ github.event.issue.pull_request.url }}
155-
env:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157-
id: load_pr
158-
159-
- name: Get PR information
160-
run: |
161-
echo "::set-output name=branch::${{ fromJson(steps.load_pr.outputs.data).head.ref }}"
162-
echo "::set-output name=head_sha::${{ fromJson(steps.load_pr.outputs.data).head.sha }}"
163-
echo "::set-output name=repo_name::${{ fromJson(steps.load_pr.outputs.data).base.repo.full_name }}"
164-
echo "::set-output name=repo_url::${{ fromJson(steps.load_pr.outputs.data).base.repo.html_url }}"
165-
id: pr
166-
167135
- name: Checkout PR Branch
168136
uses: actions/checkout@v2
169137
with:
170138
token: ${{ secrets.GITHUB_TOKEN }}
171-
repository: ${{ steps.pr.outputs.repo_name }}
172-
ref: ${{ steps.pr.outputs.branch }}
139+
repository: ${{ github.event.repository.full_name }}
140+
ref: ${{ github.event.pull_request.head.ref }}
173141

174142
- name: Prepare Node.js
175143
uses: actions/setup-node@v2
@@ -214,13 +182,13 @@ jobs:
214182
if: ${{ failure() }}
215183
with:
216184
route: POST /repos/:repository/check-runs
217-
repository: ${{ steps.pr.outputs.repo_name }}
185+
repository: ${{ github.event.repository.full_name }}
218186
mediaType: |
219187
previews:
220188
- antiope
221189
name: ${{ env.WIBY_CHECK_NAME }}
222-
details_url: "${{ steps.pr.outputs.repo_url }}/actions/runs/${{ github.run_id }}"
223-
head_sha: ${{ steps.pr.outputs.head_sha }}
190+
details_url: "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
191+
head_sha: ${{ github.event.pull_request.head.sha }}
224192
conclusion: "failure"
225193
env:
226194
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -230,13 +198,13 @@ jobs:
230198
if: ${{ steps.wiby_result.outputs.wiby_conclusion != '' }}
231199
with:
232200
route: POST /repos/:repository/check-runs
233-
repository: ${{ steps.pr.outputs.repo_name }}
201+
repository: ${{ github.event.repository.full_name }}
234202
mediaType: |
235203
previews:
236204
- antiope
237205
name: ${{ env.WIBY_CHECK_NAME }}
238-
details_url: "${{ steps.pr.outputs.repo_url }}/actions/runs/${{ github.run_id }}"
239-
head_sha: ${{ steps.pr.outputs.head_sha }}
206+
details_url: "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
207+
head_sha: ${{ github.event.pull_request.head.sha }}
240208
conclusion: ${{ steps.wiby_result.outputs.wiby_conclusion }}
241209
env:
242210
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)