Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/job-backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Backport
# Opens backport pull requests to the LTS branches when a pull request with the
# `cherry-pick?` label is merged to master. Commits are cherry-picked with `-x`.
# Each branch comments on the original pull request with the backport link, or
# says that a manual backport is needed.
# says that a manual backport is needed. If all branches succeed, the label is
# removed.
#
# The label must be set before merging.
#
Expand Down Expand Up @@ -94,4 +95,24 @@ jobs:
gh pr comment "$PR" --body "Backport to $BRANCH: $URL"
else
gh pr comment "$PR" --body "Backport to $BRANCH failed, manual backport needed: $RUN_URL"
# Fail the job so the label is kept
exit 1
fi

remove_label:
needs: backport
runs-on: ubuntu-latest
steps:
- name: Remove the label
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
MERGE_SHA: ${{ github.sha }}
run: |
pr=$(gh api "repos/$GH_REPO/commits/$MERGE_SHA/pulls" \
--jq 'first(.[] | select(any(.labels[]; .name == "cherry-pick?")) | .number)')
if [ -z "$pr" ]; then
echo "No merged PR with the cherry-pick? label, nothing to do"
exit 0
fi
gh pr edit "$pr" --remove-label "cherry-pick?"
Loading