From 5b6baba3ea3809c096f10badb760d65a0bc6286f Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Wed, 23 Oct 2024 16:11:21 +0530 Subject: [PATCH 1/3] Snyk Fail Fix --- .github/workflows/snyk.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index 0dc6792a..f134ac0a 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -11,7 +11,12 @@ on: - main schedule: - cron: "30 0 1,15 * *" - workflow_dispatch: + workflow_dispatch: + inputs: + pr_number: + description: 'Pull Request number to run the workflow on (for fork PRs)' + required: false + default: '' permissions: contents: read @@ -54,7 +59,9 @@ jobs: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.merge_commit_sha || github.ref }} + ref: | + ${{ github.event.pull_request.merge_commit_sha || + (github.event_name == 'workflow_dispatch' && inputs.pr_number != '' ? 'refs/pull/' + inputs.pr_number + '/head' : github.ref) }} - uses: ./.github/actions/setup with: From 209bff3fdab3349d378ef3f08188f6338294d86f Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Wed, 23 Oct 2024 16:15:13 +0530 Subject: [PATCH 2/3] Indentation Fix --- .github/workflows/snyk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index f134ac0a..642a1529 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -11,7 +11,7 @@ on: - main schedule: - cron: "30 0 1,15 * *" - workflow_dispatch: + workflow_dispatch: inputs: pr_number: description: 'Pull Request number to run the workflow on (for fork PRs)' From 56925a77f45c783aabfe8be5d26c1df09e069f9b Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Wed, 23 Oct 2024 16:19:07 +0530 Subject: [PATCH 3/3] update Checkout --- .github/workflows/snyk.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index 642a1529..99a3b3b7 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -14,9 +14,9 @@ on: workflow_dispatch: inputs: pr_number: - description: 'Pull Request number to run the workflow on (for fork PRs)' + description: "Pull Request number to run the workflow on (for fork PRs)" required: false - default: '' + default: "" permissions: contents: read @@ -59,9 +59,7 @@ jobs: - uses: actions/checkout@v4 with: - ref: | - ${{ github.event.pull_request.merge_commit_sha || - (github.event_name == 'workflow_dispatch' && inputs.pr_number != '' ? 'refs/pull/' + inputs.pr_number + '/head' : github.ref) }} + ref: ${{ github.event_name == 'workflow_dispatch' && inputs.pr_number != '' && format('refs/pull/{0}/head', inputs.pr_number) || github.event.pull_request.merge_commit_sha || github.ref }} - uses: ./.github/actions/setup with: