From 1980dfd43149b545e5ac2ee847ae26c33717f887 Mon Sep 17 00:00:00 2001 From: Saurabh Misra Date: Wed, 7 May 2025 20:43:00 -0700 Subject: [PATCH] Fix GHA --- .github/workflows/codeflash-optimize.yaml | 28 +---------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/.github/workflows/codeflash-optimize.yaml b/.github/workflows/codeflash-optimize.yaml index 780ee8ba7..3c35017fb 100644 --- a/.github/workflows/codeflash-optimize.yaml +++ b/.github/workflows/codeflash-optimize.yaml @@ -1,7 +1,7 @@ name: CodeFlash on: - pull_request_target: + pull_request: paths: - '**' # Trigger for all paths @@ -14,8 +14,6 @@ concurrency: jobs: optimize: name: Optimize new Python code - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} if: ${{ github.actor != 'codeflash-ai[bot]' }} runs-on: ubuntu-latest env: @@ -28,31 +26,7 @@ jobs: - name: 🛎️ Checkout uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} fetch-depth: 0 - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR is open. Proceeding with appropriate protections." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - name: 🐍 Set up Python 3.11 for CLI uses: astral-sh/setup-uv@v5