From 964c1f132c0fad73ced2cd1f0bd441b39076203c Mon Sep 17 00:00:00 2001 From: Saga4 Date: Thu, 10 Apr 2025 21:56:06 +0530 Subject: [PATCH 1/2] fix workflow triggering condition --- .github/workflows/codeflash-optimize.yaml | 9 ++++++++- .../end-to-end-test-bubblesort-pytest-no-git.yaml | 9 +++++++++ .../workflows/end-to-end-test-bubblesort-unittest.yaml | 9 +++++++++ .github/workflows/end-to-end-test-coverage.yaml | 9 +++++++++ .github/workflows/end-to-end-test-futurehouse.yaml | 9 +++++++++ .github/workflows/end-to-end-test-init-optim.yaml | 9 +++++++++ .github/workflows/end-to-end-test-tracer-replay.yaml | 9 +++++++++ .github/workflows/end-to-end-topological-sort-test.yaml | 9 +++++++++ 8 files changed, 71 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeflash-optimize.yaml b/.github/workflows/codeflash-optimize.yaml index bdfab8c25..4deb2eccb 100644 --- a/.github/workflows/codeflash-optimize.yaml +++ b/.github/workflows/codeflash-optimize.yaml @@ -1,9 +1,16 @@ name: CodeFlash on: + # For specific file changes pull_request_target: paths: - - "**" + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: concurrency: diff --git a/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml b/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml index ef0dc5149..1fe290d5d 100644 --- a/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml +++ b/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-bubblesort-unittest.yaml b/.github/workflows/end-to-end-test-bubblesort-unittest.yaml index e8c367ee2..679c11b49 100644 --- a/.github/workflows/end-to-end-test-bubblesort-unittest.yaml +++ b/.github/workflows/end-to-end-test-bubblesort-unittest.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-coverage.yaml b/.github/workflows/end-to-end-test-coverage.yaml index 5bdbde9e6..71ba79f42 100644 --- a/.github/workflows/end-to-end-test-coverage.yaml +++ b/.github/workflows/end-to-end-test-coverage.yaml @@ -1,7 +1,16 @@ name: Coverage E2E on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-futurehouse.yaml b/.github/workflows/end-to-end-test-futurehouse.yaml index 86b654152..f612424d6 100644 --- a/.github/workflows/end-to-end-test-futurehouse.yaml +++ b/.github/workflows/end-to-end-test-futurehouse.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-init-optim.yaml b/.github/workflows/end-to-end-test-init-optim.yaml index 9e35d171f..3f3f94e84 100644 --- a/.github/workflows/end-to-end-test-init-optim.yaml +++ b/.github/workflows/end-to-end-test-init-optim.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-tracer-replay.yaml b/.github/workflows/end-to-end-test-tracer-replay.yaml index e999b8f32..dff012b7f 100644 --- a/.github/workflows/end-to-end-test-tracer-replay.yaml +++ b/.github/workflows/end-to-end-test-tracer-replay.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-topological-sort-test.yaml b/.github/workflows/end-to-end-topological-sort-test.yaml index e8a1ac519..8ac7de148 100644 --- a/.github/workflows/end-to-end-topological-sort-test.yaml +++ b/.github/workflows/end-to-end-topological-sort-test.yaml @@ -1,7 +1,16 @@ name: end-to-end-test on: + # For specific file changes pull_request_target: + paths: + - '.github/workflows/**' + + # For all other changes + pull_request: + paths-ignore: + - '.github/workflows/**' + workflow_dispatch: jobs: From 027b8291c5f5c56aefa65c88d9b22c7c15d42e94 Mon Sep 17 00:00:00 2001 From: Saga4 Date: Fri, 11 Apr 2025 03:17:27 +0530 Subject: [PATCH 2/2] fix run --- .github/workflows/codeflash-optimize.yaml | 9 ++------- .../end-to-end-test-bubblesort-pytest-no-git.yaml | 9 ++------- .../end-to-end-test-bubblesort-unittest.yaml | 9 ++------- .github/workflows/end-to-end-test-coverage.yaml | 9 ++------- .../workflows/end-to-end-test-futurehouse.yaml | 9 ++------- .github/workflows/end-to-end-test-init-optim.yaml | 10 ++-------- .../workflows/end-to-end-test-tracer-replay.yaml | 10 ++-------- .../end-to-end-topological-sort-test.yaml | 15 +++++---------- .github/workflows/label-workflow-changes.yml | 4 ++-- 9 files changed, 21 insertions(+), 63 deletions(-) diff --git a/.github/workflows/codeflash-optimize.yaml b/.github/workflows/codeflash-optimize.yaml index 4deb2eccb..ab2453154 100644 --- a/.github/workflows/codeflash-optimize.yaml +++ b/.github/workflows/codeflash-optimize.yaml @@ -1,15 +1,10 @@ name: CodeFlash on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: diff --git a/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml b/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml index 1fe290d5d..a5d6ad42d 100644 --- a/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml +++ b/.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml @@ -1,15 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: diff --git a/.github/workflows/end-to-end-test-bubblesort-unittest.yaml b/.github/workflows/end-to-end-test-bubblesort-unittest.yaml index 679c11b49..521bc41d4 100644 --- a/.github/workflows/end-to-end-test-bubblesort-unittest.yaml +++ b/.github/workflows/end-to-end-test-bubblesort-unittest.yaml @@ -1,15 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: diff --git a/.github/workflows/end-to-end-test-coverage.yaml b/.github/workflows/end-to-end-test-coverage.yaml index 71ba79f42..93ffb4b46 100644 --- a/.github/workflows/end-to-end-test-coverage.yaml +++ b/.github/workflows/end-to-end-test-coverage.yaml @@ -1,15 +1,10 @@ name: Coverage E2E on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: diff --git a/.github/workflows/end-to-end-test-futurehouse.yaml b/.github/workflows/end-to-end-test-futurehouse.yaml index f612424d6..349753bf3 100644 --- a/.github/workflows/end-to-end-test-futurehouse.yaml +++ b/.github/workflows/end-to-end-test-futurehouse.yaml @@ -1,15 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: diff --git a/.github/workflows/end-to-end-test-init-optim.yaml b/.github/workflows/end-to-end-test-init-optim.yaml index 3f3f94e84..f3c1f7a4c 100644 --- a/.github/workflows/end-to-end-test-init-optim.yaml +++ b/.github/workflows/end-to-end-test-init-optim.yaml @@ -1,16 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' - + - '**' # Trigger for all paths workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-test-tracer-replay.yaml b/.github/workflows/end-to-end-test-tracer-replay.yaml index dff012b7f..82d11b9cd 100644 --- a/.github/workflows/end-to-end-test-tracer-replay.yaml +++ b/.github/workflows/end-to-end-test-tracer-replay.yaml @@ -1,16 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' - + - '**' # Trigger for all paths workflow_dispatch: jobs: diff --git a/.github/workflows/end-to-end-topological-sort-test.yaml b/.github/workflows/end-to-end-topological-sort-test.yaml index 8ac7de148..0e65c51c6 100644 --- a/.github/workflows/end-to-end-topological-sort-test.yaml +++ b/.github/workflows/end-to-end-topological-sort-test.yaml @@ -1,15 +1,10 @@ name: end-to-end-test on: - # For specific file changes + # Use pull_request_target for everything to ensure access to secrets pull_request_target: paths: - - '.github/workflows/**' - - # For all other changes - pull_request: - paths-ignore: - - '.github/workflows/**' + - '**' # Trigger for all paths workflow_dispatch: @@ -32,7 +27,7 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR + - name: Validate PR for workflow changes run: | # Check for any workflow changes if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then @@ -43,8 +38,8 @@ jobs: # Allowlist check if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "✅ PR is open. Assuming protection rules are in place. Proceeding." else echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." exit 1 diff --git a/.github/workflows/label-workflow-changes.yml b/.github/workflows/label-workflow-changes.yml index 1738c5309..ec074af53 100644 --- a/.github/workflows/label-workflow-changes.yml +++ b/.github/workflows/label-workflow-changes.yml @@ -24,9 +24,9 @@ jobs: owner: context.repo.owner, repo: context.repo.repo }); - + const labelExists = labels.data.some(label => label.name === labelName); - + if (!labelExists) { // Create the label if it doesn't exist await github.rest.issues.createLabel({