[6.14.z] Fix test AK create with CV #7986
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
# CI stages to execute against all branches on PR merge | |
name: auto_cherry_pick_commits | |
on: | |
pull_request_target: | |
types: [closed, labeled] | |
# Github & Parent PR Env vars | |
env: | |
assignee: ${{ github.event.pull_request.assignee.login }} | |
title: ${{ github.event.pull_request.title }} | |
number: ${{ github.event.number }} | |
is_dependabot_pr: '' | |
jobs: | |
# Pre-Requisites for Auto Cherrypicking | |
find-the-parent-prt-comment: | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') | |
name: Find & Save last PRT comment of Parent PR | |
runs-on: ubuntu-latest | |
outputs: | |
prt_comment: ${{steps.fc.outputs.comment-body}} | |
steps: | |
- name: Find Comment | |
uses: peter-evans/find-comment@v2 | |
id: fc | |
with: | |
issue-number: ${{ env.number }} | |
body-includes: "trigger: test-robottelo" | |
# Auto CherryPicking and Failure Recording | |
auto-cherry-pick: | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CherryPick') | |
name: Auto Cherry Pick to labeled branches | |
needs: find-the-parent-prt-comment | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
label: ${{ github.event.pull_request.labels.*.name }} | |
steps: | |
## Robottelo Repo Checkout | |
- uses: actions/checkout@v4 | |
if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} | |
with: | |
fetch-depth: 0 | |
## Set env var for dependencies label PR | |
- name: Set env var is_dependabot_pr to `dependencies` to set the label | |
if: contains(github.event.pull_request.labels.*.name, 'dependencies') | |
run: | | |
echo "is_dependabot_pr=dependencies" >> $GITHUB_ENV | |
## CherryPicking and AutoMerging | |
- name: Cherrypicking to zStream branch | |
id: cherrypick | |
if: ${{ startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} | |
uses: jyejare/github-cherry-pick-action@main | |
with: | |
token: ${{ secrets.CHERRYPICK_PAT }} | |
branch: ${{ matrix.label }} | |
labels: | | |
Auto_Cherry_Picked | |
${{ matrix.label }} | |
No-CherryPick | |
${{ env.is_dependabot_pr }} | |
assignees: ${{ env.assignee }} | |
- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's | |
id: add-parent-prt-comment | |
if: ${{ always() && steps.cherrypick.outcome == 'success' }} | |
uses: mshick/add-pr-comment@v2 | |
with: | |
issue: ${{ steps.cherrypick.outputs.number }} | |
message: ${{ needs.find-the-parent-prt-comment.outputs.prt_comment }} | |
repo-token: ${{ secrets.CHERRYPICK_PAT }} | |
- name: is autoMerging enabled for Auto CherryPicked PRs ? | |
if: ${{ always() && steps.cherrypick.outcome == 'success' && contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') }} | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.CHERRYPICK_PAT }} | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: ${{ steps.cherrypick.outputs.number }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["AutoMerge_Cherry_Picked"] | |
}) | |
## Failure Logging to issues and GChat Group | |
- name: Create Github issue on cherrypick failure | |
id: create-issue | |
if: ${{ always() && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }} | |
uses: dacbd/create-issue-action@main | |
with: | |
token: ${{ secrets.CHERRYPICK_PAT }} | |
title: "[Failed-AutoCherryPick] - ${{ env.title }}" | |
body: | | |
#### Auto-Cherry-Pick WorkFlow Failure: | |
- To Branch: ${{ matrix.label }} | |
- [Failed Cherrypick Action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
- [Parent Pull Request](https://github.com/${{ github.repository }}/pull/${{ github.event.number }}) | |
labels: Failed_AutoCherryPick,${{ matrix.label }} | |
assignees: ${{ env.assignee }} |