Merge pull request #904 from fluxcd/backport-automation

Add backport GitHub Action workflow
This commit is contained in:
Stefan Prodan 2023-06-30 16:30:09 +03:00 committed by GitHub
commit dd18c720ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 2 deletions

View File

@ -3,7 +3,7 @@ version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
labels: ["area/build"]
labels: ["area/ci", "dependencies"]
schedule:
# by default this will be on a monday.
# By default, this will be on a monday.
interval: "weekly"

22
.github/labels.yaml vendored Normal file
View File

@ -0,0 +1,22 @@
# Configuration file to declaratively configure labels
# Ref: https://github.com/EndBug/label-sync#Config-files
- name: area/kustomize
description: Kustomize related issues and PRs
color: '#00e54d'
- name: area/kstatus
description: Health checking related issues and PRs
color: '#25D5CA'
aliases: ['area/health-checks']
- name: area/sops
description: SOPS related issues and PRs
color: '#FEE5D1'
- name: area/server-side-apply
description: SSA related issues and PRs
color: '#2819CB'
- name: area/varsub
description: Post-build variable substitution related issues and PRs
color: '#8D195D'
- name: backport:release/v1.0.x
description: To be backported to release/v1.0.x
color: '#ffd700'

32
.github/workflows/backport.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: backport
on:
pull_request_target:
types: [closed, labeled]
permissions:
contents: read
jobs:
pull-request:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: github.event.pull_request.state == 'closed' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport:', github.event.label.name))
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
uses: korthout/backport-action@bf5fdd624b35f95d5b85991a728bd5744e8c6cf2 # v1.3.1
# xref: https://github.com/korthout/backport-action#inputs
with:
# Match labels with a pattern `backport:<target-branch>`
label_pattern: '^backport:([^ ]+)$'
# A bit shorter pull-request title than the default
pull_title: '[${target_branch}] ${pull_title}'
# Simpler PR description than default
pull_description: |-
Automated backport to `${target_branch}`, triggered by a label in #${pull_number}.

28
.github/workflows/sync-labels.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: sync-labels
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/labels.yaml
permissions:
contents: read
jobs:
labels:
name: Run sync
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: EndBug/label-sync@da00f2c11fdb78e4fae44adac2fdd713778ea3e8 # v2.3.2
with:
# Configuration file
config-file: |
https://raw.githubusercontent.com/fluxcd/community/main/.github/standard-labels.yaml
.github/labels.yaml
# Strictly declarative
delete-other-labels: true