Compare commits

...

5 Commits

Author SHA1 Message Date
ChrisVandoo
2c318678ea silent api 2026-08-07 17:01:12 -04:00
ChrisVandoo
7b676936b2 testing changes 2026-08-07 16:52:15 -04:00
ChrisVandoo
cbf1e50d5c fix message, whitespace 2026-08-07 16:45:15 -04:00
ChrisVandoo
7e8220f429 cleanup double/triple backport logic, fail if labels set 2026-08-07 16:35:27 -04:00
ChrisVandoo
a697a2fd0f post warning about deprecated labels 2026-08-07 16:26:32 -04:00

View File

@@ -3,6 +3,10 @@ run-name: Auto Backport ${{ github.event.pull_request.title }}
on:
pull_request:
types: [closed, labeled]
# TESTING ONLY — remove before merge. Restricts this workflow to PRs whose
# base is the test branch, so trial PRs don't fire the real backport jobs.
branches:
- dev-2428-remove-double-backport-and-triple-backport-labels
jobs:
# --- Primary path: backport to every supported release line --------------
@@ -85,7 +89,6 @@ jobs:
legacy-backport:
if:
| # triggered only by the legacy depth labels, at merge or when added afterwards
github.event.pull_request.merged == true && (
github.event.action == 'closed' && (
contains(github.event.pull_request.labels.*.name, 'single-backport') ||
contains(github.event.pull_request.labels.*.name, 'double-backport') ||
@@ -96,9 +99,36 @@ jobs:
github.event.label.name == 'double-backport' ||
github.event.label.name == 'triple-backport'
)
)
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
steps:
- name: "!! double-backport and triple-backport label deprecation warning !!"
if:
|
github.event.action == 'closed' && (
contains(github.event.pull_request.labels.*.name, 'double-backport') ||
contains(github.event.pull_request.labels.*.name, 'triple-backport')
) ||
github.event.action == 'labeled' && (
github.event.label.name == 'double-backport' ||
github.event.label.name == 'triple-backport'
)
env:
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
run: |
msg="🚨🚨 Backport failed because \`double-backport\` and \`triple-backport\` labels are **deprecated**! Use the \`backport\` label to port changes to all supported releases instead. 🚨🚨"
gh api \
--silent \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2026-03-10" \
/repos/"$REPO"/issues/"$PR"/comments \
-f "body=$msg"
echo "::error::$msg"
exit 1
- uses: actions/checkout@v6
with:
fetch-depth: 0
@@ -110,29 +140,6 @@ jobs:
pull-request-number: ${{ github.event.pull_request.number }}
base-ref: ${{ github.event.pull_request.base.ref }}
- name: how many backports?
id: how-many-backports
uses: actions/github-script@v9
with:
script: | # js
const labels = [
...${{ toJson(github.event.pull_request.labels) }},
{ name:"${{ github.event.label.name }}" }
];
const backportLabelNames = labels.filter(label => label.name.includes('backport')).map(label => label.name);
let result = 1;
if (backportLabelNames.includes("triple-backport")) {
result = 3;
} else if (backportLabelNames.includes("double-backport")) {
result = 2;
}
console.log("backports", result);
return result;
- name: get release versions
id: get-latest-release-version
uses: actions/github-script@v9
@@ -157,21 +164,3 @@ jobs:
backport-commit: ${{ steps.find_commit.outputs.commit }}
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
github-token-2: ${{ secrets.GITHUB_TOKEN }}
- name: Double Backport
if: ${{ always() && fromJson(steps.how-many-backports.outputs.result) >= 2 }}
uses: ./.github/actions/create-backport
with:
target-version: ${{ fromJson(steps.get-latest-release-version.outputs.result).secondLatest }}
backport-commit: ${{ steps.find_commit.outputs.commit }}
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
github-token-2: ${{ secrets.GITHUB_TOKEN }}
- name: Triple Backport
if: ${{ always() && fromJson(steps.how-many-backports.outputs.result) >= 3 }}
uses: ./.github/actions/create-backport
with:
target-version: ${{ fromJson(steps.get-latest-release-version.outputs.result).thirdLatest }}
backport-commit: ${{ steps.find_commit.outputs.commit }}
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
github-token-2: ${{ secrets.GITHUB_TOKEN }}