File tree Expand file tree Collapse file tree 8 files changed +72
-17
lines changed Expand file tree Collapse file tree 8 files changed +72
-17
lines changed Original file line number Diff line number Diff line change 11name : CodeFlash
22
33on :
4- # Use pull_request_target for everything to ensure access to secrets
54 pull_request_target :
65 paths :
76 - ' **' # Trigger for all paths
@@ -15,7 +14,14 @@ concurrency:
1514jobs :
1615 optimize :
1716 name : Optimize new Python code
18- environment : external-trusted-contributors
17+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
18+ environment : ${{
19+ github.event_name == 'workflow_dispatch' ||
20+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
21+ github.event.pull_request.user.login != 'misrasaurabh1' &&
22+ github.event.pull_request.user.login != 'KRRT7'
23+ ? 'external-trusted-contributors' : ' '
24+ }}
1925 if : ${{ github.actor != 'codeflash-ai[bot]' }}
2026 runs-on : ubuntu-latest
2127 env :
4248 # Allowlist check
4349 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4450 echo "✅ Authorized user ($AUTHOR). Proceeding."
45- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github. event.pull_request.state }}" == "open" ]]; then
46- echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding ."
51+ elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
52+ echo "✅ PR is open. Proceeding with appropriate protections ."
4753 else
4854 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
4955 exit 1
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 bubble-sort-optimization-pytest-no-git :
13- environment : external-trusted-contributors
13+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
14+ environment : ${{
15+ github.event_name == 'workflow_dispatch' ||
16+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17+ github.event.pull_request.user.login != 'misrasaurabh1' &&
18+ github.event.pull_request.user.login != 'KRRT7'
19+ ? 'external-trusted-contributors' : ' '
20+ }}
1421 runs-on : ubuntu-latest
1522 env :
1623 CODEFLASH_AIS_SERVER : prod
3946 # Allowlist check
4047 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4148 echo "✅ Authorized user ($AUTHOR). Proceeding."
42- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github. event.pull_request.state }}" == "open" ]]; then
49+ elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
4350 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4451 else
4552 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 bubble-sort-optimization-unittest :
13- environment : external-trusted-contributors
13+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
14+ environment : ${{
15+ github.event_name == 'workflow_dispatch' ||
16+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17+ github.event.pull_request.user.login != 'misrasaurabh1' &&
18+ github.event.pull_request.user.login != 'KRRT7'
19+ ? 'external-trusted-contributors' : ' '
20+ }}
1421 runs-on : ubuntu-latest
1522 env :
1623 CODEFLASH_AIS_SERVER : prod
3946 # Allowlist check
4047 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4148 echo "✅ Authorized user ($AUTHOR). Proceeding."
42- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
49+ elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
4350 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4451 else
4552 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 end-to-end-test-coverage :
13- environment : external-trusted-contributors
13+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
14+ environment : ${{
15+ github.event_name == 'workflow_dispatch' ||
16+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17+ github.event.pull_request.user.login != 'misrasaurabh1' &&
18+ github.event.pull_request.user.login != 'KRRT7'
19+ ? 'external-trusted-contributors' : ' '
20+ }}
1421 runs-on : ubuntu-latest
1522 env :
1623 CODEFLASH_AIS_SERVER : prod
3744 # Allowlist check
3845 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
3946 echo "✅ Authorized user ($AUTHOR). Proceeding."
40- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
47+ elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
4148 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4249 else
4350 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 futurehouse-structure :
13- environment : external-trusted-contributors
13+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
14+ environment : ${{
15+ github.event_name == 'workflow_dispatch' ||
16+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17+ github.event.pull_request.user.login != 'misrasaurabh1' &&
18+ github.event.pull_request.user.login != 'KRRT7'
19+ ? 'external-trusted-contributors' : ' '
20+ }}
1421 runs-on : ubuntu-latest
1522 env :
1623 CODEFLASH_AIS_SERVER : prod
3946 # Allowlist check
4047 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4148 echo "✅ Authorized user ($AUTHOR). Proceeding."
42- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
49+ elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
4350 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4451 else
4552 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 99
1010jobs :
1111 init-optimization :
12- environment : external-trusted-contributors
12+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
13+ environment : ${{
14+ github.event_name == 'workflow_dispatch' ||
15+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
16+ github.event.pull_request.user.login != 'misrasaurabh1' &&
17+ github.event.pull_request.user.login != 'KRRT7'
18+ ? 'external-trusted-contributors' : ' '
19+ }}
1320 runs-on : ubuntu-latest
1421 env :
1522 CODEFLASH_AIS_SERVER : prod
3845 # Allowlist check
3946 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4047 echo "✅ Authorized user ($AUTHOR). Proceeding."
41- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
48+ elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
4249 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4350 else
4451 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 99
1010jobs :
1111 tracer-replay :
12- environment : external-trusted-contributors
12+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
13+ environment : ${{
14+ github.event_name == 'workflow_dispatch' ||
15+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
16+ github.event.pull_request.user.login != 'misrasaurabh1' &&
17+ github.event.pull_request.user.login != 'KRRT7'
18+ ? 'external-trusted-contributors' : ' '
19+ }}
1320 runs-on : ubuntu-latest
1421 env :
1522 CODEFLASH_AIS_SERVER : prod
3845 # Allowlist check
3946 if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
4047 echo "✅ Authorized user ($AUTHOR). Proceeding."
41- elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
48+ elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
4249 echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4350 else
4451 echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
Original file line number Diff line number Diff line change 1010
1111jobs :
1212 topological-sort-optimization :
13- environment : external-trusted-contributors
13+ # Dynamically determine if environment is needed only when workflow files change and contributor is external
14+ environment : ${{
15+ github.event_name == 'workflow_dispatch' ||
16+ contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') &&
17+ github.event.pull_request.user.login != 'misrasaurabh1' &&
18+ github.event.pull_request.user.login != 'KRRT7'
19+ ? 'external-trusted-contributors' : ' '
20+ }}
1421 runs-on : ubuntu-latest
1522 env :
1623 CODEFLASH_AIS_SERVER : prod
You can’t perform that action at this time.
0 commit comments