Skip to content

Commit 12e87a4

Browse files
add label to pr
Made a workflow to add a label to a pr
1 parent 1c965c1 commit 12e87a4

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/add-label.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test adding label to pr
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_run:
9+
workflows: ["Build PR From Fork"]
10+
types: ["completed"]
11+
branches-ignore: ["main"]
12+
13+
jobs:
14+
prepare_jobs:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
pr_number: '${{ steps.get_pr_number.outputs.pr_number }}'
18+
steps:
19+
- name: Download PR info
20+
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
21+
with:
22+
workflow: ""
23+
run_id: "${{ github.event.workflow_run.id }}"
24+
workflow_conclusion: success
25+
name: pr
26+
path: ./
27+
28+
- name: Get PR number
29+
shell: sh
30+
id: get_pr_number
31+
run: |
32+
echo "::set-output name=pr_number::$(cat NUM | tr -dc '[:digit:]')"
33+
notify_failure:
34+
runs-on: ubuntu-latest
35+
env:
36+
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
37+
steps:
38+
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
39+
- name: Label
40+
uses: ./.github/actions/fork-result-label
41+
continue-on-error: true
42+
with:
43+
SUCCESS: 'false'
44+
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}
45+
46+
notify_success:
47+
runs-on: ubuntu-latest
48+
env:
49+
PR_NUMBER: ${{ needs.prepare_jobs.outputs.pr_number }}
50+
steps:
51+
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
52+
- name: Label
53+
uses: ./.github/actions/fork-result-label
54+
continue-on-error: true
55+
with:
56+
SUCCESS: 'true'
57+
PULL_REQUEST_NUMBER: ${{ env.PR_NUMBER }}

0 commit comments

Comments
 (0)