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 f27a27f
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,35 @@ 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
echo "PR_DESCRIPTION=$PR_DESCRIPTION" >> $GITHUB_ENV
- name: Extract associated required core PR number
id: pr_core_number
run: |
echo "PR_CORE_NUMBER=$(echo $PR_DESCRIPTION | grep -o 'https://github.com/mysociety/alaveteli/pull/[0-9]*' | grep -o '[0-9]*$')" >> $GITHUB_ENV
- name: Get core branch name
id: pr_core_branch
run: |
if [[ ! -z "$PR_CORE_NUMBER" ]]; then
echo "PR_CORE_BRANCH=$(gh pr view https://github.com/mysociety/alaveteli/pull/$PR_CORE_NUMBER --json headRefName -q '.headRefName')" >> $GITHUB_ENV
else
echo "PR_CORE_BRANCH=develop" >> $GITHUB_ENV
fi
- name: Checkout Alaveteli
uses: actions/checkout@v2
with:
repository: mysociety/alaveteli
ref: develop
ref: $PR_CORE_BRANCH
path: core
submodules: true
fetch-depth: 0
Expand Down

0 comments on commit f27a27f

Please sign in to comment.