From 7475d464121268c2e975c8a37fa05cace0cc8a50 Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Mon, 16 Dec 2024 09:46:31 -0800 Subject: [PATCH] Make workflows run if it's being run in public repo, or it was triggered by pull request. --- .github/workflows/codegen.yml | 3 +++ .github/workflows/continuous-integration.yml | 6 ++++++ .github/workflows/lint.yml | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml index 9bcce460f..fe22c5f20 100644 --- a/.github/workflows/codegen.yml +++ b/.github/workflows/codegen.yml @@ -1,11 +1,14 @@ name: Codegen on: + push: + branches: [ main ] pull_request: workflow_dispatch: jobs: codegen: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ${{ matrix.os }} name: Java ${{ matrix.java }} ${{ matrix.os }} strategy: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index dd2dd8f12..25cb14ced 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,6 +1,8 @@ name: CI on: + push: + branches: [ main ] pull_request: workflow_dispatch: @@ -9,6 +11,7 @@ env: jobs: apple-ci: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ${{ matrix.runner }} strategy: fail-fast: false @@ -101,6 +104,7 @@ jobs: | xcbeautify apple-downstream: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ${{ matrix.runner }} strategy: fail-fast: false @@ -221,6 +225,7 @@ jobs: | xcbeautify linux-ci: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ubuntu-latest strategy: fail-fast: false @@ -273,6 +278,7 @@ jobs: run: swift test linux-downstream: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fa2c3568c..14d1049ca 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,11 +1,14 @@ name: Lint on: + push: + branches: [ main ] pull_request: workflow_dispatch: jobs: ktlint: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - name: Checkout sources @@ -14,6 +17,7 @@ jobs: run: ./gradlew ktlint swiftlint: + if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request' runs-on: ubuntu-latest container: image: ghcr.io/realm/swiftlint:0.54.0