Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip deploy when only md files are updated #1351

Merged
merged 3 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/build_validation_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,14 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
# The conditions below define the desired behaviour of the deployment
# workflow:
# 1. The workflow must NOT be triggered automatically by an opened
# pull request
# 2. It should be possible to manually trigger the workflow for PRs
# originating from forks (using "safe to test" label)
# 3. The workflow must run when scheduled, pushed (i.e., merge) or
# manually triggered
if: |
github.event.pull_request.head.repo.full_name == github.repository
|| contains(github.event.pull_request.labels.*.name, 'safe to test')
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of
# changed files within `super-linter`
fetch-depth: 0
persist-credentials: false

- name: Lint code base
uses: github/super-linter@v4
Expand All @@ -48,12 +38,22 @@ jobs:
VALIDATE_JAVA: true
JAVA_FILE_NAME: checkstyle.xml

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
terraform:
# our Terraform uses more than just *.tf files, so need to check changes in the folder
- '**/terraform/**/*'

- name: Terraform format check
if: ${{ steps.filter.outputs.terraform == 'true' }}
run: terraform fmt -check -recursive

# find all terraform folders and run validate to catch
# configuration errors
- name: Terraform validation
if: ${{ steps.filter.outputs.terraform == 'true' }}
run: |
find . -type d -name 'terraform' -not -path '*cnab*' -print0 \
| xargs -0 -I{} sh -c 'echo "***** Validating: {} *****"; \
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/deploy_tre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
|| contains(github.event.pull_request.labels.*.name, 'safe to test'))
outputs:
refid: ${{ steps.run-id.outputs.refid }}
not-md: ${{ steps.filter.outputs.not-md }}
steps:
- id: run-id
name: Get run id
Expand All @@ -77,9 +78,36 @@ jobs:
echo "using id of: ${REFID} for GitHub Ref: ${GITHUB_REF}"
echo "::set-output name=refid::${REFID}"

- name: Checkout
# Code is used by orny/paths-filter action but not required for pull requests
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v2
with:
persist-credentials: false

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
not-md:
# we need to check for changes in files other than *.md
- '**/!(*.md)'

# If we don't run the actual deploy (below) we won't receive a check-run status,
# and will have to send it "manually"
- name: Bypass E2E check-runs status
if: ${{ steps.filter.outputs.not-md == 'false' }}
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
# the name must be identical to the one received by the real job
name: "Deploy PR / Run E2E Tests (Smoke)"
status: "completed"
conclusion: "success"

run-deploy-tre-not-main:
name: "Deploy PR"
if: github.ref != 'refs/heads/main'
if: ${{ github.ref != 'refs/heads/main' && needs.prepare-not-main.outputs.not-md == 'true' }}
needs: [prepare-not-main]
uses: ./.github/workflows/deploy_tre_reusable.yml
secrets:
Expand Down