File tree Expand file tree Collapse file tree 8 files changed +147
-15
lines changed Expand file tree Collapse file tree 8 files changed +147
-15
lines changed Original file line number Diff line number Diff line change 11name : CodeFlash
22
33on :
4- pull_request :
4+ pull_request_target :
55 paths :
66 - " **"
77 workflow_dispatch :
@@ -13,6 +13,7 @@ concurrency:
1313jobs :
1414 optimize :
1515 name : Optimize new Python code
16+ environment : external-trusted-contributors
1617 if : ${{ github.actor != 'codeflash-ai[bot]' }}
1718 runs-on : ubuntu-latest
1819 env :
2627 uses : actions/checkout@v4
2728 with :
2829 fetch-depth : 0
30+ - name : Validate PR
31+ run : |
32+ # Checking for any workflow changes for security risks
33+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
34+ echo "Workflow changes detected."
35+
36+ # Check if the PR author is allowed
37+ AUTHOR="${{ github.event.pull_request.user.login }}"
38+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
39+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
40+ exit 1
41+ else
42+ echo "Authorized user ($AUTHOR). Proceeding."
43+ fi
44+ fi
2945
3046 - name : 🐍 Set up Python 3.11 for CLI
3147 uses : astral-sh/setup-uv@v5
4359 id : optimize_code
4460 run : |
4561 source .venv/bin/activate
46- poetry run codeflash
62+ poetry run codeflash
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 bubble-sort-optimization-pytest-no-git :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fi
2440
2541 - name : Set up Python 3.11 for CLI
2642 uses : astral-sh/setup-uv@v5
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 bubble-sort-optimization-unittest :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fi
2440
2541 - name : Set up Python 3.11 for CLI
2642 uses : astral-sh/setup-uv@v5
3854 id : optimize_code
3955 run : |
4056 source .venv/bin/activate
41- poetry run python tests/scripts/end_to_end_test_bubblesort_unittest.py
57+ poetry run python tests/scripts/end_to_end_test_bubblesort_unittest.py
Original file line number Diff line number Diff line change 11name : Coverage E2E
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 end-to-end-test-coverage :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
1920 with :
2021 fetch-depth : 0
2122 token : ${{ secrets.GITHUB_TOKEN }}
23+ - name : Validate PR
24+ run : |
25+ # Checking for any workflow changes for security risks
26+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
27+ echo "Workflow changes detected."
28+
29+ # Check if the PR author is allowed
30+ AUTHOR="${{ github.event.pull_request.user.login }}"
31+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
32+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
33+ exit 1
34+ else
35+ echo "Authorized user ($AUTHOR). Proceeding."
36+ fi
37+ fi
2238
2339 - name : Set up Python 3.11 for CLI
2440 uses : astral-sh/setup-uv@v5
3753 id : optimize_code
3854 run : |
3955 source .venv/bin/activate
40- poetry run python tests/scripts/end_to_end_test_coverage.py
56+ poetry run python tests/scripts/end_to_end_test_coverage.py
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 futurehouse-structure :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fi
2440
2541 - name : Set up Python 3.11 for CLI
2642 uses : astral-sh/setup-uv@v5
3854 id : optimize_code
3955 run : |
4056 source .venv/bin/activate
41- poetry run python tests/scripts/end_to_end_test_futurehouse.py
57+ poetry run python tests/scripts/end_to_end_test_futurehouse.py
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 init-optimization :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fi
2440
2541 - name : Set up Python 3.11 for CLI
2642 uses : astral-sh/setup-uv@v5
3854 id : optimize_code
3955 run : |
4056 source .venv/bin/activate
41- poetry run python tests/scripts/end_to_end_test_init_optimization.py
57+ poetry run python tests/scripts/end_to_end_test_init_optimization.py
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 tracer-replay :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fi
40+
2441
2542 - name : Set up Python 3.11 for CLI
2643 uses : astral-sh/setup-uv@v5
3855 id : optimize_code
3956 run : |
4057 source .venv/bin/activate
41- poetry run python tests/scripts/end_to_end_test_tracer_replay.py
58+ poetry run python tests/scripts/end_to_end_test_tracer_replay.py
Original file line number Diff line number Diff line change 11name : end-to-end-test
22
33on :
4- pull_request :
4+ pull_request_target :
55 workflow_dispatch :
66
77jobs :
88 topological-sort-optimization :
9+ environment : external-trusted-contributors
910 runs-on : ubuntu-latest
1011 env :
1112 CODEFLASH_AIS_SERVER : prod
2122 with :
2223 fetch-depth : 0
2324 token : ${{ secrets.GITHUB_TOKEN }}
25+ - name : Validate PR
26+ run : |
27+ # Checking for any workflow changes for security risks
28+ if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "^.github/workflows/"; then
29+ echo "Workflow changes detected."
30+
31+ # Check if the PR author is allowed
32+ AUTHOR="${{ github.event.pull_request.user.login }}"
33+ if [[ "$AUTHOR" != "misrasaurabh1" && "$AUTHOR" != "KRRT7" ]]; then
34+ echo "Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
35+ exit 1
36+ else
37+ echo "Authorized user ($AUTHOR). Proceeding."
38+ fi
39+ fiif git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q "end-to-end-topological-sort-test.yaml"; then
40+ echo "This workflow file has been modified. Exiting for security."
41+ exit 1
42+ fi
2443
2544 - name : Set up Python 3.11 for CLI
2645 uses : astral-sh/setup-uv@v5
3857 id : optimize_code
3958 run : |
4059 source .venv/bin/activate
41- poetry run python tests/scripts/end_to_end_test_topological_sort.py
60+ poetry run python tests/scripts/end_to_end_test_topological_sort.py
You can’t perform that action at this time.
0 commit comments