Skip to content

Commit

Permalink
use github.event.repository.default_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
p-wall committed Jul 8, 2024
1 parent 27f4a9d commit 2551c6d
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ on:
push:

jobs:
prepare-to-run:
runs-on: ubuntu-latest
outputs:
default-branch: ${{ steps.default-branch.outputs.branch }}
steps:
- name: Determine default Git branch name
id: default-branch
run: |
default_branch=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }} | jq -r .default_branch)
echo "branch=$default_branch" >> "$GITHUB_OUTPUT"
test:
needs:
- prepare-to-run
runs-on: ubuntu-latest
env:
BUNDLE_PATH: vendor/bundle
Expand Down Expand Up @@ -58,8 +45,6 @@ jobs:
retention-days: 5

prepare-app-image:
needs:
- prepare-to-run
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -91,10 +76,9 @@ jobs:
${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/pipeline:sha-${{ github.sha }}
deploy:
if: github.ref == 'refs/heads/${{ needs.prepare-to-run.outputs.default-branch }}'
if: github.ref == github.event.repository.default_branch
needs:
- test
- prepare-to-run
- prepare-app-image
concurrency:
group: deploy-to-production-${{ github.ref }}
Expand All @@ -105,7 +89,6 @@ jobs:
- name: Checkout Pipeline repository
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare-to-run.outputs.default-branch }}
fetch-depth: 0

- name: Checkout stack repository
Expand Down

0 comments on commit 2551c6d

Please sign in to comment.