Skip to content

CI: (deps): Bump github/codeql-action from 4.34.1 to 4.35.1 in /.github/workflows #3275

CI: (deps): Bump github/codeql-action from 4.34.1 to 4.35.1 in /.github/workflows

CI: (deps): Bump github/codeql-action from 4.34.1 to 4.35.1 in /.github/workflows #3275

Workflow file for this run

name: Backport PRs
on:
pull_request_target:
types:
- closed
- labeled
jobs:
Backport:
environment:
name: PR Backport
deployment: false
runs-on: ubuntu-slim
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'backport' )
permissions:
pull-requests: write
contents: write
env:
GH_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
steps:
- name: Create App Token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Configure Git
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Checkout PR HEAD
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 100
- name: Fetch PR merge base
run: git fetch --no-tags --depth=100 origin "$GH_BASE_SHA"
- name: Get backport branch
id: get-branch
run: |
git fetch --no-tags --depth=100 origin 'refs/heads/*.x:refs/remotes/origin/*.x'
echo "backport-branch=$(git branch -r | grep '.*.x' | sort -V | tail -n 1 | cut -d / -f 2)" >> $GITHUB_OUTPUT
- name: Apply PR commits to ${{ steps.get-branch.outputs.backport-branch}} branch
run: |
git checkout -b ${{ steps.get-branch.outputs.backport-branch}} origin/${{ steps.get-branch.outputs.backport-branch}}
git cherry-pick -x "$GH_BASE_SHA".."$GH_HEAD_SHA"
- name: Create backport PR
id: create-pr
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ steps.app-token.outputs.token }}
title: '${{ github.event.pull_request.title }} (backport)'
body: >
Backport \#${{ github.event.number }} onto the
${{ steps.get-branch.outputs.backport-branch}} stable branch.
base: ${{ steps.get-branch.outputs.backport-branch}}
branch: backport-pr-${{ github.event.number }}
delete-branch: true
labels: 'backported-pr,${{ join(github.event.pull_request.labels.*.name) }}'
- uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # v1.3.0
with:
number: ${{ steps.create-pr.outputs.pull-request-number }}
labels: backport
- name: Comment on completion
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🏁 Successfully backported as #${{ steps.create-pr.outputs.pull-request-number }}. 🏁'
})
- name: Comment on error
if: failure()
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const workflow_url = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
body = `🚨 Unable to [cleanly backport](${workflow_url}) this PR! 🚨`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})