Cherry pick feat: add cf-parameters versioning
to release branch
#632
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cherry-Pick to Release Branch | |
on: | |
pull_request: | |
branches: | |
- main | |
- fix/* | |
types: | |
- closed | |
run-name: Cherry pick `${{ github.event.pull_request.title }}` to release branch | |
jobs: | |
cherry-pick: | |
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'non-breaking')) }} | |
runs-on: namespace-profile-default | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- name: Setup Git 🛠️ | |
uses: ./.github/actions/setup-git | |
with: | |
ssh-private-key: ${{ secrets.CF_GITHUB_BOT_SSH_PRIVATE_KEY }} | |
- name: Cherry-pick commit 🍒 | |
run: | | |
set -x | |
git fetch --all | |
COMMIT_SHA=$(git rev-parse HEAD) | |
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV | |
RELEASE_BRANCH="release/$(git branch -r | grep 'origin/release/[0-9]\+\.[0-9]' | sed 's/.*release\///' | sort -V | tail -n1)" | |
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV | |
git checkout $RELEASE_BRANCH | |
git cherry-pick -x $COMMIT_SHA | |
- name: Create Pull Request 🐂 | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 | |
with: | |
token: ${{ secrets.CF_BACKEND_GITHUB_TOKEN }} | |
commit-message: "pick: ${{ env.COMMIT_SHA }} to ${{ env.RELEASE_BRANCH }}" | |
title: "${{ github.event.pull_request.title }}" | |
body: | | |
This is an automated cherry-pick of ${{ env.COMMIT_SHA }} to ${{ env.RELEASE_BRANCH }}. | |
Please review and merge if appropriate. | |
Original PR: ${{ github.event.pull_request.html_url }} | |
branch: pick/non-breaking | |
base: '${{ env.RELEASE_BRANCH }}' | |
reviewers: 'martin-chainflip' | |
labels: cherry-pick | |
branch-suffix: timestamp | |
delete-branch: true | |
- name: Notify on failed cherry-pick | |
if: failure() || cancelled() | |
env: | |
DISCORD_USERNAME: "Release Picker" | |
DISCORD_WEBHOOK: ${{ secrets.CF_DISCORD_ALERTS_CRITICAL }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: | | |
🍒⚠️ Sorry **${{ github.actor }}**, The attempt to cherry-pick `${{ env.COMMIT_SHA }}` on to `${{ env.RELEASE_BRANCH }}` was unsuccessful | |
Please check the [GitHub job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) to see what went wrong. |