Skip to content

Commit

Permalink
Update CI GitHub workflow
Browse files Browse the repository at this point in the history
Allow PRs to checkout non develop branch from core Alaveteli. This is
useful for PRs which depend on core changes in order to work.
  • Loading branch information
gbp committed Oct 26, 2023
1 parent b43496f commit 4c2b9de
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,40 @@ jobs:
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/alaveteli_test
RAILS_ENV: test
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Get theme PR description
id: pr_theme_description
run: |
PR_DESCRIPTION=$(gh pr view https://github.com/mysociety/whatdotheyknow-theme/pull/${{ github.event.pull_request.number }} --json body -q '.body')
echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV
shell: bash

- name: Extract associated required core PR
id: pr_core_url
run: |
PR_CORE_URL=$(echo "$PR_DESCRIPTION" | grep -o 'https://github.com/mysociety/alaveteli/pull/[0-9]*')
echo "PR_CORE_URL=$PR_CORE_URL" >> $GITHUB_ENV
shell: bash

- name: Get core branch name
id: pr_core_branch
run: |
if [[ ! -z "$PR_CORE_URL" ]]; then
PR_NUMBER=$(echo "$PR_CORE_URL" | grep -o '[0-9]*$')
CORE_BRANCH_NAME=$(gh pr view https://github.com/mysociety/alaveteli/pull/$PR_NUMBER --json headRefName -q '.headRefName')
echo "CORE_BRANCH_NAME=$CORE_BRANCH_NAME" >> $GITHUB_ENV
else
echo "CORE_BRANCH_NAME=develop" >> $GITHUB_ENV
fi
shell: bash

- name: Checkout Alaveteli
uses: actions/checkout@v2
with:
repository: mysociety/alaveteli
ref: develop
ref: $CORE_BRANCH_NAME
path: core
submodules: true
fetch-depth: 0
Expand Down

0 comments on commit 4c2b9de

Please sign in to comment.