Skip to content

Commit 5fd1fcb

Browse files
authored
Add backport action (#495) (#504)
* Add backport action * Add labels action * Adjust where the backport branch happens * Changelog check action * Fix up workflows * Fix repo refs (cherry picked from commit 124d989)
1 parent c8a1035 commit 5fd1fcb

File tree

6 files changed

+106
-0
lines changed

6 files changed

+106
-0
lines changed

.backportrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"fork": false,
3+
"autoMerge": true,
24
"repoOwner": "redpanda-data",
35
"repoName": "redpanda-operator",
46
"targetBranchChoices": ["release/v2.3.x"],

.github/labels.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
labels:
2+
"backport":
3+
color: "ededed"
4+
"no-changelog":
5+
color: "8f1402"
6+
"v2.3.9":
7+
color: "ededed"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Auto-Approve Backport
2+
3+
on:
4+
pull_request_target:
5+
branches-ignore:
6+
- main
7+
8+
jobs:
9+
approve:
10+
name: Auto-approve backport
11+
runs-on: ubuntu-latest
12+
if: startsWith(github.head_ref, 'backport/') && (github.actor == 'vbotbuildovich')
13+
permissions:
14+
pull-requests: write
15+
steps:
16+
- uses: hmarr/auto-approve-action@v4

.github/workflows/backport.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Backport
2+
3+
on:
4+
pull_request_target:
5+
types: ["labeled", "closed"]
6+
7+
jobs:
8+
backport:
9+
name: Backport PR
10+
if: github.event.pull_request.merged == true && !(contains(github.event.pull_request.labels.*.name, 'backport'))
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Backport Action
14+
uses: sorenlouv/backport-github-action@v9.5.1
15+
with:
16+
# TODO: exchange this token with a PAT of a user like our build bot
17+
github_token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Info log
20+
if: ${{ success() }}
21+
run: cat ~/.backport/backport.info.log
22+
23+
- name: Debug log
24+
if: ${{ failure() }}
25+
run: cat ~/.backport/backport.debug.log

.github/workflows/changelog.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Changelog
2+
3+
on:
4+
pull_request:
5+
types: ["labeled", "unlabeled", "opened", "synchronize"]
6+
branches:
7+
# only check for changelog entries going into main
8+
- main
9+
10+
jobs:
11+
changed_files:
12+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
13+
runs-on: ubuntu-latest
14+
name: Check for changelog entry
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Get all changed changelog files
19+
id: changed-changelog-files
20+
uses: tj-actions/changed-files@v45
21+
with:
22+
files: |
23+
.changes/unreleased/**.yaml
24+
25+
- name: Pass
26+
if: steps.changed-changelog-files.outputs.any_changed == 'true'
27+
run: |
28+
echo "Found changelog entry"
29+
30+
- name: Fail
31+
if: steps.changed-changelog-files.outputs.any_changed != 'true'
32+
run: |
33+
echo "No changelog entry detected." && exit 1

.github/workflows/labels.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Manage Labels
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- .github/labels.yml
9+
workflow_dispatch:
10+
11+
concurrency: manage-labels
12+
13+
jobs:
14+
manage-labels:
15+
permissions:
16+
contents: read
17+
issues: write
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: oliversalzburg/action-label-manager@v0.0.9
22+
with:
23+
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)