Skip to content

Commit f4d26c0

Browse files
delannialbertoblaz
authored andcommitted
Revert "[CI] Trigger backports when v* labels are added afterwards (elastic#234452)" (elastic#240946)
## Summary This reverts commit 040e409 in elastic#234452
1 parent 1cf2d17 commit f4d26c0

File tree

5 files changed

+10
-118
lines changed

5 files changed

+10
-118
lines changed

.github/workflows/_fixtures_/github_event_onmerge_1.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/_fixtures_/github_event_onmerge_2.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/_fixtures_/github_event_onmerge_3.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/_fixtures_/github_event_onmerge_4.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/on-merge.yml

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,22 @@ on:
55
- labeled
66
- unlabeled
77

8-
concurrency:
9-
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
10-
cancel-in-progress: true
11-
128
jobs:
139
on-merge:
1410
name: 'Label and Backport'
1511
runs-on: ubuntu-latest
16-
if: github.event.pull_request.merged == true
12+
if: |
13+
github.event.pull_request.merged == true &&
14+
(github.event.action == 'closed' ||
15+
(github.event.action == 'labeled' &&
16+
(github.event.label.name == 'backport:all-open' ||
17+
github.event.label.name == 'backport:version')) ||
18+
(github.event.action == 'unlabeled' &&
19+
github.event.label.name == 'backport:skip' &&
20+
(contains(github.event.pull_request.labels.*.name, 'backport:all-open') ||
21+
contains(github.event.pull_request.labels.*.name, 'backport:version'))))
1722
steps:
18-
- run: "echo hello!"
19-
- name: Check out versions.json
20-
uses: actions/checkout@v5
21-
with:
22-
repository: 'elastic/kibana'
23-
ref: main
24-
sparse-checkout: |
25-
versions.json
26-
- name: Check Event Qualifies
27-
uses: actions/github-script@v7
28-
id: check_event
29-
with:
30-
result-encoding: string
31-
script: |
32-
let shouldRun = false;
33-
const backportLabels = { skip: 'backport:skip', allOpen: 'backport:all-open', version: 'backport:version' };
34-
const { pull_request: pr, action } = context.payload;
35-
const labels = pr.labels.map(l => l.name);
36-
const validVersionLabels = require('./versions.json').versions
37-
.map(v => v.version.split('.').slice(0,2).join('.'))
38-
.map(v => RegExp(`^v${v}\.[0-9]{1,2}$`));
39-
const labelsWarrantBackport = labels.includes(backportLabels.allOpen) || (
40-
labels.includes(backportLabels.version) &&
41-
labels.some(label => validVersionLabels.some(v => v.test(label)))
42-
);
43-
44-
if (action === 'closed') {
45-
core.info('PR was merged, proceeding');
46-
shouldRun = true;
47-
} else if ((action === 'labeled' || action === 'unlabeled') && labelsWarrantBackport) {
48-
core.info('labelling action warrants backport, proceeding');
49-
shouldRun = true;
50-
} else {
51-
core.info('event does not warrant backport action, skipping');
52-
shouldRun = false;
53-
}
54-
55-
core.info(`Should run on-merge action: ${shouldRun}`);
56-
return shouldRun.toString();
57-
5823
- name: Checkout Actions
59-
if: ${{ steps.check_event.outputs.result == 'true' }}
6024
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6125
with:
6226
repository: 'elastic/kibana-github-actions'
@@ -65,11 +29,9 @@ jobs:
6529
persist-credentials: false
6630

6731
- name: Install Actions
68-
if: ${{ steps.check_event.outputs.result == 'true' }}
6932
run: npm install --production --prefix ./actions
7033

7134
- name: Run On-Merge
72-
if: ${{ steps.check_event.outputs.result == 'true' }}
7335
uses: ./actions/on-merge
7436
with:
7537
github_token: ${{secrets.KIBANAMACHINE_TOKEN}}

0 commit comments

Comments
 (0)