Skip to content

Bump requests from 2.32.5 to 2.33.1 in /requirements/partial #673

Bump requests from 2.32.5 to 2.33.1 in /requirements/partial

Bump requests from 2.32.5 to 2.33.1 in /requirements/partial #673

Workflow file for this run

name: Cherry pick staging PRs merged into main
on:
pull_request_target:
types:
- closed
branches:
- 'main'
jobs:
create-pr-for-staging:
# contains(join()) to first join all labels into one string and then check
# if contains 'staging'
if: |
github.event.pull_request.merged == true &&
contains(join(github.event.pull_request.labels.*.name, ''), 'staging')
name: Create PR against staging branch
runs-on: ubuntu-latest
strategy:
matrix:
label: ${{ github.event.pull_request.labels.*.name }}
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 2
- name: Skip if not staging or no matching branch
run: |
if ! echo "${{ matrix.label }}" | grep -q '^staging' ; then
echo 'Not a staging label. Skipping remaining steps for label ${{ matrix.label }} ...'
echo "skip_pick=true" >> $GITHUB_ENV # Set env var
elif ! git ls-remote --heads origin '${{ matrix.label }}/*' | grep -qc . ; then
echo 'No matching branch found. Skipping remaining steps for label ${{ matrix.label }} ...'
echo "skip_pick=true" >> $GITHUB_ENV # Set env var
else
echo 'Matching branch for label ${{ matrix.label }} exists. Continuing ...'
fi
- name: Fetch and checkout latest staging branch
if: env.skip_pick != 'true' # Conditional execution
run: |
branch=$(git ls-remote --heads origin '${{ matrix.label }}/*' | awk 'gsub(".*refs/heads/","")' | sort -V | tail -1)
git fetch origin $branch
git checkout $branch
- name: Set git credentials
if: env.skip_pick != 'true' # Conditional execution
run: |
git config --global user.name openslides-automation
git config --global user.email openslides-automation@users.noreply.github.com
- name: Cherry-pick new commit
if: env.skip_pick != 'true' # Conditional execution
id: cherry-pick
run: |
git fetch origin
# -m 1 to also be able to cherry-pick merge commits
git cherry-pick -m 1 ${{ github.sha }} || {
echo "error=1" >> $GITHUB_OUTPUT
git add .
git cherry-pick --continue
}
- name: Generate access token
if: env.skip_pick != 'true' # Conditional execution
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
- name: Create or update PR
if: env.skip_pick != 'true' # Conditional execution
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.generate-token.outputs.token }}
branch: apply/${{ matrix.label }}/commit-${{ github.sha }}
delete-branch: true
title: "[Cherry-Pick] ${{ github.event.pull_request.title }}"
body: "Triggered by commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})\n\n${{ steps.cherry-pick.outputs.error && 'There were conflicts during the cherry-pick. These were commited without any resolving. Please resolve them manually and push the result to this branch before merging.' || 'The cherry-pick was successful without any conflicts. You should be able to simply merge this PR.' }}"
reviewers: ${{ github.event.pull_request.user.login }}
assignees: ${{ github.event.pull_request.user.login }}
labels: picked-to-staging