From 3601afc5735c8c98a4cda4c53eed263e0230ba05 Mon Sep 17 00:00:00 2001 From: David Strome <21028455+dstrome@users.noreply.github.com> Date: Wed, 26 Mar 2025 14:14:06 -0700 Subject: [PATCH] Add check to run only if triggered from MicrosoftDocs repo --- .github/workflows/AutoLabelMsftContributor.yml | 6 +++--- .github/workflows/BackgroundTasks.yml | 3 ++- .github/workflows/BuildValidation.yml | 4 +--- .github/workflows/LiveMergeCheck.yml | 6 ++---- .github/workflows/PrFileCount.yml | 6 ++---- .github/workflows/ProtectedFiles.yml | 6 ++---- .github/workflows/Stale.yml | 1 + .github/workflows/StaleBranch.yml | 3 ++- .github/workflows/TierManagement.yml | 4 ++-- 9 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/AutoLabelMsftContributor.yml b/.github/workflows/AutoLabelMsftContributor.yml index c41825acc8..6fcfb6e43e 100644 --- a/.github/workflows/AutoLabelMsftContributor.yml +++ b/.github/workflows/AutoLabelMsftContributor.yml @@ -13,7 +13,7 @@ on: jobs: download-payload: - if: github.repository_visibility == 'public' + if: github.repository_owner == 'MicrosoftDocs' && github.repository_visibility == 'public' name: Download and extract payload artifact uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-ExtractPayload.yml@workflows-prod with: @@ -24,7 +24,7 @@ jobs: label-msft: name: Label Microsoft contributors - if: github.repository_visibility == 'public' + if: github.repository_owner == 'MicrosoftDocs' && github.repository_visibility == 'public' needs: [download-payload] uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-AutoLabelMsftContributor.yml@workflows-prod with: @@ -32,4 +32,4 @@ jobs: secrets: AccessToken: ${{ secrets.GITHUB_TOKEN }} ClientId: ${{ secrets.M365_APP_CLIENT_ID }} - PrivateKey: ${{ secrets.M365_APP_PRIVATE_KEY }} + PrivateKey: ${{ secrets.M365_APP_PRIVATE_KEY }} \ No newline at end of file diff --git a/.github/workflows/BackgroundTasks.yml b/.github/workflows/BackgroundTasks.yml index c0389bb252..8dc3ceae0a 100644 --- a/.github/workflows/BackgroundTasks.yml +++ b/.github/workflows/BackgroundTasks.yml @@ -9,6 +9,7 @@ on: jobs: upload: + if: github.repository_owner == 'MicrosoftDocs' runs-on: ubuntu-latest steps: @@ -23,4 +24,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: PayloadJson - path: pr/ + path: pr/ \ No newline at end of file diff --git a/.github/workflows/BuildValidation.yml b/.github/workflows/BuildValidation.yml index e57844b453..dadccacbef 100644 --- a/.github/workflows/BuildValidation.yml +++ b/.github/workflows/BuildValidation.yml @@ -11,11 +11,9 @@ on: jobs: build-status: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-BuildValidation.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} secrets: AccessToken: ${{ secrets.GITHUB_TOKEN }} - - - diff --git a/.github/workflows/LiveMergeCheck.yml b/.github/workflows/LiveMergeCheck.yml index faeb2a0ef4..7db35548e9 100644 --- a/.github/workflows/LiveMergeCheck.yml +++ b/.github/workflows/LiveMergeCheck.yml @@ -12,11 +12,9 @@ on: jobs: live-merge: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-LiveMergeCheck.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} secrets: - AccessToken: ${{ secrets.GITHUB_TOKEN }} - - - \ No newline at end of file + AccessToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/PrFileCount.yml b/.github/workflows/PrFileCount.yml index 40f7d61629..17faf7a211 100644 --- a/.github/workflows/PrFileCount.yml +++ b/.github/workflows/PrFileCount.yml @@ -12,11 +12,9 @@ on: jobs: file-count: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-PrFileCount.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} secrets: - AccessToken: ${{ secrets.GITHUB_TOKEN }} - - - + AccessToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ProtectedFiles.yml b/.github/workflows/ProtectedFiles.yml index 007f8f04b1..bbdbbe2e40 100644 --- a/.github/workflows/ProtectedFiles.yml +++ b/.github/workflows/ProtectedFiles.yml @@ -10,11 +10,9 @@ on: [pull_request_target] jobs: protected-files: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-ProtectedFiles.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} secrets: - AccessToken: ${{ secrets.GITHUB_TOKEN }} - - - \ No newline at end of file + AccessToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/Stale.yml b/.github/workflows/Stale.yml index dec280f776..7f262d325a 100644 --- a/.github/workflows/Stale.yml +++ b/.github/workflows/Stale.yml @@ -11,6 +11,7 @@ on: jobs: stale: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-Stale.yml@workflows-prod with: RunDebug: false diff --git a/.github/workflows/StaleBranch.yml b/.github/workflows/StaleBranch.yml index 470eadbd32..f55d979291 100644 --- a/.github/workflows/StaleBranch.yml +++ b/.github/workflows/StaleBranch.yml @@ -13,6 +13,7 @@ on: jobs: stale-branch: + if: github.repository_owner == 'MicrosoftDocs' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-StaleBranch.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} @@ -22,4 +23,4 @@ jobs: ]' ReportOnly: true secrets: - AccessToken: ${{ secrets.GITHUB_TOKEN }} + AccessToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/TierManagement.yml b/.github/workflows/TierManagement.yml index c9aedb08b6..47baf0be65 100644 --- a/.github/workflows/TierManagement.yml +++ b/.github/workflows/TierManagement.yml @@ -11,11 +11,11 @@ on: jobs: tier-mgmt: - if: github.repository_visibility == 'private' + if: github.repository_owner == 'MicrosoftDocs' && github.repository_visibility == 'private' uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-TierManagement.yml@workflows-prod with: PayloadJson: ${{ toJSON(github) }} EnableWriteSignOff: 1 EnableReadOnlySignoff: 1 secrets: - AccessToken: ${{ secrets.GITHUB_TOKEN }} + AccessToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file