Skip to content

More updates to Gitlab Workflow (#5589) #355

More updates to Gitlab Workflow (#5589)

More updates to Gitlab Workflow (#5589) #355

Workflow file for this run

name: Cherrypick bugfixes to release branch
on:
push:
branches:
- dev
jobs:
# Check if the PR is a bugfix
check_labels:
runs-on: ubuntu-latest
permissions:
pull-requests: write
name: Check PR labels action step
# Make the output of this job available to other jobs
outputs:
result: ${{steps.execute_py_script.outputs.result}}
steps:
- name: checkout repo content
uses: actions/checkout@v2 # checkout the repository content
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r ./.github/requirements.txt
- name: Set output
id: execute_py_script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_API_URL: ${{ secrets.GITHUB_API_URL }}
GITHUB_SERVER_URL: ${{ secrets.GITHUB_SERVER_URL }}
GITHUB_SHA: ${{ secrets.GITHUB_SHA }}
run: |
echo "result=$(python ./.github/pr_label_checker.py)" >> $GITHUB_OUTPUT
# Print the result to the log
- name: See result
run: echo "${{ steps.execute_py_script.outputs.result }}"
release_pull_request:
needs: check_labels
# Only run this step if the code was a bugfix
if: contains(needs.check_labels.outputs.result, 'true')
runs-on: ubuntu-latest
name: release_pull_request
steps:
- name: checkout
uses: actions/[email protected]
# Fetch all info including branches + tags
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: get_latest_tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- id: get_short_version
# Get the major / minor version without patch info i.e. 6.0 from 6.0.1
run: |
major_minor=$(echo ${{steps.get_latest_tag.outputs.tag}} | cut -d '.' -f 1,2)
echo "::set-output name=major_minor::$major_minor"
- name: Create PR to branch
uses: adamtharani/github-action-cherry-pick@master
# PR to the latest feature release. Merges are enabled
with:
pr_branch: ${{steps.get_short_version.outputs.major_minor}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: false