Skip to content

Bump actions/checkout from 4 to 5 #20

Bump actions/checkout from 4 to 5

Bump actions/checkout from 4 to 5 #20

Workflow file for this run

# Copyright 2025 NVIDIA CORPORATION
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Cherry-Pick
on:
issue_comment:
types: [created]
pull_request_target:
types: [closed]
permissions:
contents: write
pull-requests: write
issues: write
jobs:
add-labels:
name: Add Cherry-Pick Labels from Comment
runs-on: ubuntu-latest
# Run on /cherry-pick comments on PRs
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/cherry-pick')
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "nvidia-backport-bot"
git config user.email "[email protected]"
- name: Add labels and handle backport
uses: actions/github-script@v8
with:
script: |
const run = require('./.github/scripts/add-labels-from-comment.js');
return await run({ github, context, core });
backport:
name: Backport PR
runs-on: ubuntu-latest
# Run when PR is merged and has cherry-pick labels
if: |
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged == true &&
contains(join(github.event.pull_request.labels.*.name, ','), 'cherry-pick/')
steps:
- name: Checkout base branch repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract target branches from PR labels
id: extract-branches
uses: actions/github-script@v8
with:
script: |
const run = require('./.github/scripts/extract-branches.js');
return await run({ github, context, core });
- name: Configure git
if: steps.extract-branches.outputs.result != '[]'
run: |
git config user.name "nvidia-backport-bot"
git config user.email "[email protected]"
- name: Backport to release branches
id: backport
if: steps.extract-branches.outputs.result != '[]'
uses: actions/github-script@v8
env:
BRANCHES_JSON: ${{ steps.extract-branches.outputs.result }}
with:
script: |
const run = require('./.github/scripts/backport.js');
return await run({ github, context, core });