From 1f8c3cdb1103c56b79803a32b7ce5de8b265a57b Mon Sep 17 00:00:00 2001 From: Keepers Date: Fri, 2 Sep 2022 16:30:18 -0600 Subject: [PATCH] only run actions on /src changes (#750) ## Description Re-opening the PR with a hack (sourced from github themselves) to skip the required check if we don't run the standard required jobs. ## Type of change - [x] :sunflower: Feature ## Issue(s) #744 ## Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .github/workflows/ci-skip.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 10 ++++++++-- .github/workflows/docgen.yml | 5 +++-- .github/workflows/image.yml | 4 ++++ .github/workflows/lint.yml | 12 +++++++++++- 5 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci-skip.yml diff --git a/.github/workflows/ci-skip.yml b/.github/workflows/ci-skip.yml new file mode 100644 index 000000000..7f869ae7f --- /dev/null +++ b/.github/workflows/ci-skip.yml @@ -0,0 +1,30 @@ +name: CI Tests +on: + push: + branches: [main] + paths-ignore: + - '/src/**' + - '/.github/**' + pull_request: + branches: [main] + paths-ignore: + - '/src/**' + - '/.github/**' + +# Intentional no-op used to tell the build system that +# required actions like Test-Suite and Linting have passed +# successfully, even though they were skipped. + +# This hack brought to you by docs.github.com +# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks + +jobs: + Test-Suite: + runs-on: ubuntu-latest + steps: + - run: 'echo "Build step skipped - no testing required" ' + + Linting: + runs-on: ubuntu-latest + steps: + - run: 'echo "Build step skipped - no linting required" ' \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f39f9c5c3..e255f3999 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,18 @@ name: CI Tests on: push: branches: [main] + paths: + - '/src/**' + - '/.github/**' pull_request: branches: [main] + paths: + - '/src/**' + - '/.github/**' permissions: # required to retrieve AWS credentials id-token: write - # required to retrieve repository contents: read jobs: @@ -19,7 +24,8 @@ jobs: run: working-directory: src steps: - - name: Repo Code Checkout + + - name: Checkout repository uses: actions/checkout@v3 # Get values for cache paths to be used in later steps diff --git a/.github/workflows/docgen.yml b/.github/workflows/docgen.yml index 845b704b6..5432dbbe1 100644 --- a/.github/workflows/docgen.yml +++ b/.github/workflows/docgen.yml @@ -2,6 +2,9 @@ name: Document Generation on: push: branches: [main] + paths: + - '/src/**' + - '/.github/**' permissions: contents: write @@ -13,12 +16,10 @@ jobs: runs-on: ubuntu-latest steps: - # check out the repo - name: Repo Code Checkout uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.ref }} - # persist-credentials: false # Get values for cache paths to be used in later steps - id: go-cache-paths diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 91aa8533a..9a82fc076 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -2,6 +2,9 @@ name: Publish Docker Container Images on: push: branches: [main] + paths: + - '/src/**' + - '/.github/**' permissions: contents: read @@ -16,6 +19,7 @@ jobs: env: PLATFORMS: linux/amd64,linux/arm64 steps: + - name: Checkout repository uses: actions/checkout@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 62612ef22..e5e8d4f27 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,8 +2,17 @@ name: Lint on: push: branches: [main] + paths: + - '/src/**' + - '/.github/**' pull_request: branches: [main] + paths: + - '/src/**' + - '/.github/**' + +permissions: + contents: read jobs: Linting: @@ -13,7 +22,8 @@ jobs: run: working-directory: src steps: - - name: Checkout src code + + - name: Checkout repository uses: actions/checkout@v3 # Get values for cache paths to be used in later steps