From e4aef8c108316ed35913c308eceefe83614a1487 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 25 Oct 2023 11:30:30 -0400 Subject: [PATCH] Restrict workflows to run on apache/beam (#29133) --- .github/workflows/beam_MetricsCredentialsRotation.yml | 5 +++-- .github/workflows/beam_Metrics_Report.yml | 5 +++-- .github/workflows/beam_PostCommit_BeamMetrics_Publish.yml | 5 +++-- .github/workflows/beam_Publish_Beam_SDK_Snapshots.yml | 5 +++-- .github/workflows/beam_Publish_Docker_Snapshots.yml | 5 +++-- .github/workflows/beam_Release_NightlySnapshot.yml | 5 +++-- .github/workflows/beam_Release_Python_NightlySnapshot.yml | 5 +++-- .github/workflows/build_runner_image.yml | 1 + 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/beam_MetricsCredentialsRotation.yml b/.github/workflows/beam_MetricsCredentialsRotation.yml index 7b9727053aaa3..839a8cba0ed07 100644 --- a/.github/workflows/beam_MetricsCredentialsRotation.yml +++ b/.github/workflows/beam_MetricsCredentialsRotation.yml @@ -49,8 +49,9 @@ env: jobs: beam_MetricsCredentialsRotation: if: | - github.event_name == 'workflow_dispatch' || - github.event_name == 'schedule' + (github.event_name == 'workflow_dispatch' || + github.event_name == 'schedule') && + github.repository == 'apache/beam' runs-on: [self-hosted, ubuntu-20.04, main] timeout-minutes: 100 name: ${{ matrix.job_name }} diff --git a/.github/workflows/beam_Metrics_Report.yml b/.github/workflows/beam_Metrics_Report.yml index 0c88171f50c18..9c4a540e7ef0c 100644 --- a/.github/workflows/beam_Metrics_Report.yml +++ b/.github/workflows/beam_Metrics_Report.yml @@ -60,9 +60,10 @@ jobs: job_name: [beam_Metrics_Report] job_phrase: [Run Metrics Report] if: | - github.event_name == 'schedule' || + (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || - github.event.comment.body == 'Run Metrics Report' + github.event.comment.body == 'Run Metrics Report') && + github.repository == 'apache/beam' steps: - uses: actions/checkout@v3 - name: Setup repository diff --git a/.github/workflows/beam_PostCommit_BeamMetrics_Publish.yml b/.github/workflows/beam_PostCommit_BeamMetrics_Publish.yml index 9cff830828a20..15ab008cec304 100644 --- a/.github/workflows/beam_PostCommit_BeamMetrics_Publish.yml +++ b/.github/workflows/beam_PostCommit_BeamMetrics_Publish.yml @@ -53,10 +53,11 @@ env: jobs: beam_PostCommit_BeamMetrics_Publish: if: | - github.event_name == 'push' || + (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || - github.event.comment.body == 'Run Beam Metrics Deployment' + github.event.comment.body == 'Run Beam Metrics Deployment') && + github.repository == 'apache/beam' runs-on: [self-hosted, ubuntu-20.04, main] timeout-minutes: 100 name: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) diff --git a/.github/workflows/beam_Publish_Beam_SDK_Snapshots.yml b/.github/workflows/beam_Publish_Beam_SDK_Snapshots.yml index 9e48325b89ab4..95f993bc33acc 100644 --- a/.github/workflows/beam_Publish_Beam_SDK_Snapshots.yml +++ b/.github/workflows/beam_Publish_Beam_SDK_Snapshots.yml @@ -50,8 +50,9 @@ env: jobs: beam_Publish_Beam_SDK_Snapshots: if: | - github.event_name == 'workflow_dispatch' || - github.event_name == 'schedule' + (github.event_name == 'workflow_dispatch' || + github.event_name == 'schedule') && + github.repository == 'apache/beam' runs-on: [self-hosted, ubuntu-20.04, main] timeout-minutes: 100 name: ${{ matrix.job_name }} (${{ matrix.container_task }}) diff --git a/.github/workflows/beam_Publish_Docker_Snapshots.yml b/.github/workflows/beam_Publish_Docker_Snapshots.yml index 01b846eb65d0a..1abc268630671 100644 --- a/.github/workflows/beam_Publish_Docker_Snapshots.yml +++ b/.github/workflows/beam_Publish_Docker_Snapshots.yml @@ -50,9 +50,10 @@ env: jobs: beam_Publish_Docker_Snapshots: if: | - github.event_name == 'workflow_dispatch' || + (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || - github.event.comment.body == 'Publish Docker Snapshots' + github.event.comment.body == 'Publish Docker Snapshots') && + github.repository == 'apache/beam' runs-on: [self-hosted, ubuntu-20.04, main] timeout-minutes: 100 name: ${{ matrix.job_name }} (${{ matrix.job_phrase }}) diff --git a/.github/workflows/beam_Release_NightlySnapshot.yml b/.github/workflows/beam_Release_NightlySnapshot.yml index bf22344c4199b..735d0e466177a 100644 --- a/.github/workflows/beam_Release_NightlySnapshot.yml +++ b/.github/workflows/beam_Release_NightlySnapshot.yml @@ -50,8 +50,9 @@ jobs: job_name: [beam_Release_NightlySnapshot] job_phrase: [Release Nightly Snapshot] if: | - github.event_name == 'workflow_dispatch' || - github.event_name == 'schedule' + (github.event_name == 'workflow_dispatch' || + github.event_name == 'schedule') && + github.repository == 'apache/beam' steps: - uses: actions/checkout@v4 - name: Setup repository diff --git a/.github/workflows/beam_Release_Python_NightlySnapshot.yml b/.github/workflows/beam_Release_Python_NightlySnapshot.yml index a9f4ac5d2d145..fe132356fc532 100644 --- a/.github/workflows/beam_Release_Python_NightlySnapshot.yml +++ b/.github/workflows/beam_Release_Python_NightlySnapshot.yml @@ -49,8 +49,9 @@ jobs: matrix: job_name: [beam_Release_Python_NightlySnapshot] job_phrase: [Release Nightly Snapshot Python] - if: github.event_name == 'workflow_dispatch' || - github.event_name == 'schedule' + if: (github.event_name == 'workflow_dispatch' || + github.event_name == 'schedule') && + github.repository == 'apache/beam' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/build_runner_image.yml b/.github/workflows/build_runner_image.yml index 6071d936958ad..c0f4cacd86fe8 100644 --- a/.github/workflows/build_runner_image.yml +++ b/.github/workflows/build_runner_image.yml @@ -30,6 +30,7 @@ env: docker_repo: apache-beam-testing/beam-github-actions/beam-arc-runner jobs: build-and-version-runner: + if: github.repository == 'apache/beam' env: working-directory: .github/gh-actions-self-hosted-runners/arc/images/ runs-on: [self-hosted, ubuntu-20.04]