From cabaebb4b023971d118cabbb792986bfcbb92ab6 Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Mon, 30 Jan 2023 16:57:39 +0800 Subject: [PATCH] [action] Update github actions on trigger and label. (#13542) Why I did it github action will report error on forked repos. It is not by design. keep 'Approved for xxx branch' label in auto cherry pick workflow. How I did it Disable github action on folked repos. Keep 'approved for xxx' label in auto cherry pick workflow. How to verify it Which release bra --- .github/workflows/automerge_scan.yml | 1 + .github/workflows/codeql-analysis.yml | 1 + .github/workflows/label.yml | 1 + .github/workflows/pr_cherrypick_poststep.yml | 2 +- .github/workflows/semgrep.yml | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automerge_scan.yml b/.github/workflows/automerge_scan.yml index d2c970a159dc..b89e594720e7 100644 --- a/.github/workflows/automerge_scan.yml +++ b/.github/workflows/automerge_scan.yml @@ -6,6 +6,7 @@ on: jobs: automerge_scan: + if: github.repository_owner == 'sonic-net' runs-on: ubuntu-latest steps: - name: Debug diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6478fb99f7a5..86f17931383d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,6 +14,7 @@ on: jobs: analyze: + if: github.repository_owner == 'sonic-net' name: Analyze runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 5f8c0279b7e1..b00d61870882 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -20,6 +20,7 @@ on: jobs: label: + if: github.repository_owner == 'sonic-net' runs-on: ubuntu-latest steps: - uses: actions/labeler@main diff --git a/.github/workflows/pr_cherrypick_poststep.yml b/.github/workflows/pr_cherrypick_poststep.yml index 7be0b7d7cbe5..a343bed03ef6 100644 --- a/.github/workflows/pr_cherrypick_poststep.yml +++ b/.github/workflows/pr_cherrypick_poststep.yml @@ -46,4 +46,4 @@ jobs: exit 1 fi gh pr edit $origin_pr_url --add-label "Included in ${base_ref} Branch" - gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch,Approved for ${base_ref} Branch" + gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch" diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 8ebe082f50a4..975769a50566 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -10,6 +10,7 @@ on: jobs: semgrep: + if: github.repository_owner == 'sonic-net' name: Semgrep runs-on: ubuntu-latest container: