Skip to content

Instantly share code, notes, and snippets.

@watura
Last active September 22, 2023 03:39
Show Gist options
  • Save watura/1dac5230b256331a1fb00eb9d612ac29 to your computer and use it in GitHub Desktop.
Save watura/1dac5230b256331a1fb00eb9d612ac29 to your computer and use it in GitHub Desktop.
#!/bin/bash
json=$(gh pr list -B master --search "review:approved" --json number)
for number in $(echo "$json" | jq -r '.[].number'); do
gh api \
--method PUT \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/ORG/REPO/pulls/$number/update-branch
done
name: Keep update branches
on:
push:
branches:
- master
workflow_dispatch:
jobs:
update_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Branches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sh keep_update.sh
name: Keep update branches(Review Approved)
on:
pull_request_review:
types: [submitted]
jobs:
update_version:
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Branches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sh keep_update.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment