Skip to content

Commit

Permalink
Support building from forks (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi authored Oct 23, 2024
1 parent 8cf56d3 commit dd9441f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 6 additions & 23 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion terraform-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit dd9441f

Please sign in to comment.