Skip to content

Commit a08b9c1

Browse files
Add label with fork pr pipeline result (#1108)
* Labeling step Added step to the pipeline so it will use the new action to add the pipeline end status to the pr as a label. * Added labeling action Added action to add label to the fork pr with the pipeline result. * checkout version setting checkout version as it was * Change label content Changed labels content added * Change actions version Changed actions to add label from v1 to commit_sha to make it immutable * Add token Add token manually to be sure it doesn't get error. * Add token Added token to the action to assure it won't become an error later on (As of previous tests, in private repository, it didn't need the token as it took it manually, but in recent tests it gave error because it cannot find it)
1 parent 19db432 commit a08b9c1

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Add label to PR with CI results
2+
description: Add label to PR with CI results
3+
inputs:
4+
SUCCESS:
5+
description: Boolean to know if add a success label or a failure label.
6+
required: true
7+
TOKEN:
8+
description: Github token
9+
required: true
10+
PULL_REQUEST_NUMBER:
11+
description: Pull request id
12+
required: false
13+
default: "0"
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: delete success label
18+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0
19+
with:
20+
labels: "CI Passed"
21+
number: ${{ inputs.PULL_REQUEST_NUMBER }}
22+
- name: delete fail label
23+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0
24+
with:
25+
labels: "CI Failed"
26+
number: ${{ inputs.PULL_REQUEST_NUMBER }}
27+
- name: adding success label
28+
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8
29+
if: ${{ inputs.SUCCESS == 'true' }}
30+
with:
31+
labels: "CI Passed"
32+
number: ${{ inputs.PULL_REQUEST_NUMBER }}
33+
github_token: ${{ inputs.TOKEN }}
34+
- name: adding fail label
35+
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8
36+
if: ${{ inputs.SUCCESS == 'false' }}
37+
with:
38+
labels: "CI Failed"
39+
number: ${{ inputs.PULL_REQUEST_NUMBER }}
40+
github_token: ${{ inputs.TOKEN }}

.github/workflows/test-deploy-fork.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ jobs:
270270
❌ CI run has failed!
271271
Please see logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
272272
273+
- name: Label
274+
uses: ./.github/actions/fork-result-label
275+
continue-on-error: true
276+
with:
277+
SUCCESS: 'false'
278+
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}
279+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
280+
273281
notify_success:
274282
runs-on: ubuntu-latest
275283
if: success()
@@ -291,3 +299,11 @@ jobs:
291299
COMMENT_BODY: |
292300
✅ CI run has succeded!
293301
You can find tests and deployment logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
302+
303+
- name: Label
304+
uses: ./.github/actions/fork-result-label
305+
continue-on-error: true
306+
with:
307+
SUCCESS: 'true'
308+
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}
309+
TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)