Skip to content

Commit

Permalink
fix: update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MDavidson17 committed Nov 20, 2023
1 parent 47b78a8 commit e282a4a
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,10 @@ jobs:
- name: Run actionlint to check workflow files
run: docker run --volume="${PWD}:/repo" --workdir=/repo actionlint -color

get-infra-changes:
name: Check for Edits in ./infra/
outputs:
run_infra: ${{ steps.check_infra.outputs.infra_change}}
runs-on: ubuntu-latest

environment:
name: nonprod

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: get changes
id: check_infra
run: |
mapfile -d '' modified_infra_files < <(git diff --name-only -z ${{ github.event.before }} ${{ github.event.after }} -- "infra/*")
if [ "${#modified_infra_files[@]}" -ge 1 ]
then
echo "::set-output bame=infra_change::true"
else
echo "::set-output bame=infra_change::false"
fi
deploy-prod:
runs-on: ubuntu-latest
concurrency: deploy-prod-${{ github.ref }}
needs: [main, get-infra-changes]
needs: [main]

environment:
name: nonprod
Expand All @@ -54,13 +29,24 @@ jobs:
CLUSTER_NAME: Workflows

steps:
- name: get-changes
id: get-changes
run:
mapfile -d '' modified_infra_files < <(git diff --name-only -z ${{ github.event.before }} ${{ github.event.after }} -- "infra/*")
if [ "${#modified_infra_files[@]}" -ge 1 ]
then
echo "infra_change=true" >> $GITHUB_OUTPUT
else
echo "infra_change=false" >> $GITHUB_OUTPUT
fi

- name: Echo test needs
if: needs.get-infra-changes.outputs.run_infra == 'true'
if: steps.get-changes.outputs.infra_change == 'true'
run: |
echo test-needs-true
- name: Echo test needs
if: needs.get-infra-changes.outputs.run_infra == 'false'
if: steps.get-changes.outputs.infra_change == 'false'
run: |
echo test-needs-false
Expand Down

0 comments on commit e282a4a

Please sign in to comment.