Skip to content

Merge pull request #1067 from UKGovernmentBEIS/dependabot/npm_and_yar… #547

Merge pull request #1067 from UKGovernmentBEIS/dependabot/npm_and_yar…

Merge pull request #1067 from UKGovernmentBEIS/dependabot/npm_and_yar… #547

name: Rebase Automerged
on:
push:
branches:
- main
env:
AUTO_REBASE_PERSONAL_ACCESS_TOKEN: ${{ secrets.AUTO_REBASE_PERSONAL_ACCESS_TOKEN }}
jobs:
fetch_oldest_pr_awaiting_automerge:
runs-on: ubuntu-latest
outputs:
pr_numbers: ${{ steps.get-all-awaiting-pr-numbers.outputs.pr_numbers }}
steps:
- name: Get all awaiting PR numbers
id: get-all-awaiting-pr-numbers
run: |
PR_NUMBER=$(curl https://api.github.com/repos/UKGovernmentBEIS/regulated-professions-register/pulls\?state\=open | jq -c '[.[] | select(.auto_merge!=null) | .number] | first')
echo "::set-output name=pr_number::$PR_NUMBER"
trigger_rebase_action:
if: ${{ needs.fetch_oldest_pr_awaiting_automerge.outputs.pr_number != '' }}
env:
PR_NUMBER: ${{ needs.fetch_oldest_pr_awaiting_automerge.outputs.pr_number }}
needs: fetch_oldest_pr_awaiting_automerge
runs-on: ubuntu-latest
steps:
- name: Get the latest ref for ${{ env.PR_NUMBER }}
run: |
PR_DATA=$(curl https://api.github.com/repos/UKGovernmentBEIS/regulated-professions-register/pulls/$PR_NUMBER)
printf 'ref=%q\n' "$(echo "$PR_DATA" | jq -r .head.ref)" >> "$GITHUB_ENV"
- name: Checkout the latest code for ${{ env.PR_NUMBER }}
uses: actions/checkout@v2
with:
token: ${{ env.AUTO_REBASE_PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
ref: ${{ env.ref }}
- name: Automatic Rebase
uses: cirrus-actions/[email protected]
env:
GITHUB_TOKEN: ${{ env.AUTO_REBASE_PERSONAL_ACCESS_TOKEN }}