Skip to content

Commit

Permalink
Merge branch 'ci-allow-pr-to-checkout-non-develop-core-branch'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Oct 26, 2023
2 parents b43496f + 39228dd commit b8c3939
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [master, develop]
pull_request:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -40,13 +39,29 @@ jobs:
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/alaveteli_test
RAILS_ENV: test
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Extract associated required Alaveteli PR number
id: pr_alaveteli_number
run: |
PR_DESCRIPTION=$(gh pr view https://github.com/mysociety/whatdotheyknow-theme/pull/${{ github.event.pull_request.number }} --json body -q '.body')
echo "PR_ALAVETELI_NUMBER=$(echo $PR_DESCRIPTION | grep -o 'https://github.com/mysociety/alaveteli/pull/[0-9]*' | grep -o '[0-9]*$')" >> $GITHUB_ENV
- name: Get Alaveteli branch name
id: pr_alaveteli_branch
run: |
if [[ ! -z "$PR_ALAVETELI_NUMBER" ]]; then
echo "PR_ALAVETELI_BRANCH=$(gh pr view https://github.com/mysociety/alaveteli/pull/$PR_ALAVETELI_NUMBER --json headRefName -q '.headRefName')" >> $GITHUB_ENV
else
echo "PR_ALAVETELI_BRANCH=develop" >> $GITHUB_ENV
fi
- name: Checkout Alaveteli
uses: actions/checkout@v2
with:
repository: mysociety/alaveteli
ref: develop
ref: ${{ env.PR_ALAVETELI_BRANCH }}
path: core
submodules: true
fetch-depth: 0
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@
name: Mirror to git.mysociety.org

on:
push:
workflow_run:
workflows: [CI]
types:
- completed

jobs:

ci:
uses: ./.github/workflows/ci.yml

rubocop:
uses: ./.github/workflows/rubocop.yml

mirror:
needs: [ci, rubocop]
runs-on: ubuntu-latest
steps:

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: RuboCop

on: [pull_request, workflow_call]
on:
pull_request:

permissions:
contents: read
Expand Down

0 comments on commit b8c3939

Please sign in to comment.