From 63345f093c65de0b0a56ef43fa1eaa855c461300 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Wed, 23 Oct 2024 10:09:45 -0300 Subject: [PATCH] Support building from forks --- .github/workflows/check.yml | 21 +++++++++++++++++++++ .github/workflows/terraform.yml | 29 ++++++----------------------- terraform-scripts/README.md | 2 +- 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..57b1ce6 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,21 @@ +name: "Check Terraform Scripts" + +on: + pull_request: + branches: + - main + paths: + - 'terraform-scripts/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + terraform_only_check: + name: Check for Terraform Scripts only change + runs-on: ubuntu-latest + steps: + - name: Fail if owner is not quarkiverse + if: github.repository_owner != 'quarkiverse' + run: exit 1 diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 28ce093..e490e60 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -1,37 +1,20 @@ name: "Terraform" on: - pull_request: - branches: - - main - + workflow_run: + workflows: [ "Check Terraform Scripts" ] + types: + - completed + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - terraform_only_check: - if: github.repository_owner == 'quarkiverse' - name: Check for Terraform Scripts only change - outputs: - tf_only: ${{ steps.files.outputs.any_changed == 'true' || steps.files.outputs.any_deleted == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - - id: files - name: Get changed files - uses: tj-actions/changed-files@v42 - with: - files: terraform-scripts/** - terraform: name: "Terraform" runs-on: ubuntu-latest - if: (github.repository_owner == 'quarkiverse') && (needs.terraform_only_check.outputs.tf_only == 'true') - needs: - - terraform_only_check + if: (github.repository_owner == 'quarkiverse') defaults: run: working-directory: ./terraform-scripts diff --git a/terraform-scripts/README.md b/terraform-scripts/README.md index f6d18ac..c27ee83 100644 --- a/terraform-scripts/README.md +++ b/terraform-scripts/README.md @@ -20,7 +20,7 @@ IMPORTANT: Because the VCS is the single source of truth, you can't apply terraf New repositories are submitted via Pull Requests to the root directory in this repository. -IMPORTANT: The branch must be created in the same repository, it won't work in a separate fork (`@quarkiverse/quarkiverse-members` should be able to create new branches here) +IMPORTANT: `@quarkiverse/quarkiverse-members` should be able to create new branches here. Non-members need to fork the repository and submit a PR from the fork. 1. Add a new `.tf` script in the `terraform-scripts/` directory with the following structure: