Skip to content

Commit a32c626

Browse files
refactor(test-label): handle unlabeled event
1 parent 0327899 commit a32c626

8 files changed

Lines changed: 33 additions & 23 deletions

File tree

.github/workflows/all-green.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
- uses: actions/checkout@v4
1212

1313
- name: All Green
14-
uses: getdevopspro/github-actions/all-green@v6.2.4
14+
uses: getdevopspro/github-actions/all-green@v6.3.2

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
build:
1212
name: Build
13-
uses: getdevopspro/github-actions/.github/workflows/build.yml@v6.2.4
13+
uses: getdevopspro/github-actions/.github/workflows/build.yml@v6.3.2
1414
with:
1515
version-package: package.json
1616
version-package-lock: package-lock.json

.github/workflows/pull-request-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR - Label
22

33
on:
44
pull_request:
5-
types: [labeled]
5+
types: [labeled, unlabeled]
66

77
concurrency:
88
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.label.name }}

.github/workflows/pull-request.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,35 @@ permissions:
1515
checks: read
1616

1717
jobs:
18-
test-robot-unlabel:
19-
if: github.event.action == 'synchronize'
18+
test-robot-remove:
2019
name: Job
21-
uses: ./.github/workflows/test-robot-unlabel.yml
20+
uses: ./.github/workflows/test-robot-remove.yml
2221
with:
2322
label-test-robot-done: test-robot-done
2423
label-test-robot-needed: test-robot-needed
2524
secrets:
2625
token: ${{ secrets.BOT_REPO_TOKEN }}
2726

2827
build:
29-
needs: test-robot-unlabel
30-
if: ${{ !failure() && !cancelled() && needs.test-robot-unlabel.result != 'failure' }}
28+
needs: test-robot-remove
29+
if: ${{ !failure() && !cancelled() && needs.test-robot-remove.result != 'failure' }}
3130
name: Job
3231
uses: ./.github/workflows/build.yml
32+
# runs-on: ubuntu-latest
33+
# name: Build
34+
# steps:
35+
# - run: echo "Build step - replace with actual build commands"
3336

3437
test-robot-check:
3538
needs: build
39+
if: ${{ !cancelled() }}
3640
name: Job
3741
uses: ./.github/workflows/test-robot-check.yml
3842
with:
3943
label-test-robot-done: test-robot-done
4044
label-test-robot-needed: test-robot-needed
45+
secrets:
46+
token: ${{ secrets.BOT_REPO_TOKEN }}
4147

4248
all-green:
4349
needs: test-robot-check

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
promote:
2525
name: Job
2626
needs: build
27-
uses: getdevopspro/github-actions/.github/workflows/promote.yml@v6.2.4
27+
uses: getdevopspro/github-actions/.github/workflows/promote.yml@v6.3.2
2828
secrets:
2929
# To bypass ruleset enforcing checks
3030
checkout-token: ${{ secrets.BOT_REPO_TOKEN }}

.github/workflows/test-robot-check.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ permissions:
2424

2525
jobs:
2626
test-robot-check-labels:
27-
if: contains(github.event.pull_request.labels.*.name, inputs.label-test-robot-needed) || github.run_attempt > 1
2827
name: Robot Test Check
2928
runs-on: ubuntu-latest
3029
steps:
3130
- uses: actions/checkout@v4
3231

3332
- name: Robot Test Check
34-
uses: getdevopspro/github-actions/test/check@v6.2.4
33+
uses: getdevopspro/github-actions/test/label/check@v6.3.2
3534
with:
3635
label-done: ${{ inputs.label-test-robot-done }}
3736
label-needed: ${{ inputs.label-test-robot-needed }}

.github/workflows/test-robot-label.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,28 @@ permissions:
2525

2626
jobs:
2727
test-robot-label:
28-
if: github.event.action == 'labeled' &&
29-
github.event.label.name == inputs['label-test-robot-done']
28+
if: >
29+
github.event.label.name == inputs['label-test-robot-done'] ||
30+
github.event.label.name == inputs['label-test-robot-needed']
3031
name: Robot Test Label
3132
runs-on: ubuntu-latest
3233
steps:
3334
- uses: actions/checkout@v4
3435

35-
- name: Robot Test Label
36-
uses: getdevopspro/github-actions/test/label@v6.2.4
36+
- name: Robot Test Done Label
37+
if: >
38+
github.event.action == 'labeled' &&
39+
github.event.label.name == inputs['label-test-robot-done']
40+
uses: getdevopspro/github-actions/test/label/done/added@v6.3.2
3741
with:
3842
label-done: ${{ inputs.label-test-robot-done }}
3943
label-needed: ${{ inputs.label-test-robot-needed }}
4044
test-name: Robot
4145
token: ${{ secrets.token }}
4246

4347
- name: Rerun pull-request workflow
44-
uses: getdevopspro/github-actions/pr/checks-rerun@v6.2.4
48+
uses: getdevopspro/github-actions/pr/job-rerun@v6.3.2
4549
with:
4650
workflow-id: pull-request.yml
4751
token: ${{ secrets.token }}
52+
job-name: "Job / Robot Test Check"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Robot Test Unlabel
1+
name: Remove Robot Test
22

33
on:
44
workflow_call:
@@ -23,15 +23,15 @@ permissions:
2323
pull-requests: write
2424

2525
jobs:
26-
test-robot-unlabel:
27-
if: contains(github.event.pull_request.labels.*.name, inputs.label-test-robot-done)
28-
name: Robot Test Unlabel
29-
runs-on: ubuntu-latest|
26+
test-robot-remove:
27+
if: github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, inputs.label-test-robot-done)
28+
name: Remove Robot Test
29+
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v4
3232

33-
- name: Robot Test Unlabel
34-
uses: getdevopspro/github-actions/test/unlabel@v6.2.4
33+
- name: Remove Robot Test Label
34+
uses: getdevopspro/github-actions/test/label/done/remove@v6.3.2
3535
with:
3636
label-done: ${{ inputs.label-test-robot-done }}
3737
label-needed: ${{ inputs.label-test-robot-needed }}

0 commit comments

Comments
 (0)