diff --git a/.github/workflows/create_cache.yml b/.github/workflows/create_cache.yml index c48b9287..9b5dd1e1 100644 --- a/.github/workflows/create_cache.yml +++ b/.github/workflows/create_cache.yml @@ -9,17 +9,29 @@ name: "Create GHA cache" # branch (which is where almost all PRs merge into). on: + workflow_call: # when called from a downstream repo + inputs: + # GHA doesn't seem to provide a simple way to detect workflow_call events + # so we are using an extra input (which is only available when this workflow + # is called from another workflow) with a default value (such that we don't + # have to set it every time) + external-call: + type: boolean + default: true + required: false push: branches: [develop] # Cancel running jobs if there's a newer push concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: # GitHub Actions cache of the pre-commit environment pre-commit: + # Downstream repos have their own pre-commit environment + if: ${{!inputs.external-call}} runs-on: ubuntu-latest steps: - name: Checkout repository @@ -73,3 +85,8 @@ jobs: wget ${{ env.TEST_DATA_URL }} tar -xzvf 8.1.3_c12_6ranks_standard.tar.gz rm 8.1.3_c12_6ranks_standard.tar.gz + + pySHiELD-test-data: + # Downstream calls may not need this. If so, they should fetch it explicitly. + if: ${{!inputs.external-call}} + uses: NOAA-GFDL/pySHiELD/.github/workflows/create_cache.yml@develop