Merge pull request #2206 from UKGovernmentBEIS/2948-2946-add-is_oda-t… #900
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
name: Trigger Rebase | |
on: | |
push: | |
branches: | |
- develop | |
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/beis-report-official-development-assistance/pulls\?state\=open | jq -c '[.[] | select(.auto_merge!=null) | .number] | first') | |
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
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/beis-report-official-development-assistance/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@v3 | |
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 }} |