Skip to content

Commit de0fa75

Browse files
committed
Merge remote-tracking branch 'origin/main' into cf-600
2 parents 5fa386a + 87ea50b commit de0fa75

22 files changed

+333
-138
lines changed

.github/workflows/codeflash-optimize.yaml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: CodeFlash
33
on:
44
pull_request_target:
55
paths:
6-
- "**"
6+
- '**' # Trigger for all paths
7+
78
workflow_dispatch:
89

910
concurrency:
@@ -13,7 +14,14 @@ concurrency:
1314
jobs:
1415
optimize:
1516
name: Optimize new Python code
16-
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+
}}
1725
if: ${{ github.actor != 'codeflash-ai[bot]' }}
1826
runs-on: ubuntu-latest
1927
env:
@@ -29,18 +37,25 @@ jobs:
2937
fetch-depth: 0
3038
- name: Validate PR
3139
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."
40+
# Check for any workflow changes
41+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
42+
echo "⚠️ Workflow changes detected."
3543
36-
# Check if the PR author is allowed
44+
# Get the PR author
3745
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
46+
echo "PR Author: $AUTHOR"
47+
48+
# Allowlist check
49+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
50+
echo "✅ Authorized user ($AUTHOR). Proceeding."
51+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
52+
echo "✅ PR is open. Proceeding with appropriate protections."
4153
else
42-
echo "Authorized user ($AUTHOR). Proceeding."
54+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
55+
exit 1
4356
fi
57+
else
58+
echo "✅ No workflow file changes detected. Proceeding."
4459
fi
4560
4661
- name: 🐍 Set up Python 3.11 for CLI

.github/workflows/end-to-end-test-bubblesort-pytest-no-git.yaml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: end-to-end-test
22

33
on:
4+
# Use pull_request_target for everything to ensure access to secrets
45
pull_request_target:
6+
paths:
7+
- '**' # Trigger for all paths
8+
59
workflow_dispatch:
610

711
jobs:
812
bubble-sort-optimization-pytest-no-git:
9-
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+
}}
1021
runs-on: ubuntu-latest
1122
env:
1223
CODEFLASH_AIS_SERVER: prod
@@ -24,18 +35,25 @@ jobs:
2435
token: ${{ secrets.GITHUB_TOKEN }}
2536
- name: Validate PR
2637
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."
38+
# Check for any workflow changes
39+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
40+
echo "⚠️ Workflow changes detected."
3041
31-
# Check if the PR author is allowed
42+
# Get the PR author
3243
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
44+
echo "PR Author: $AUTHOR"
45+
46+
# Allowlist check
47+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
48+
echo "✅ Authorized user ($AUTHOR). Proceeding."
49+
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
50+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3651
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
52+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
53+
exit 1
3854
fi
55+
else
56+
echo "✅ No workflow file changes detected. Proceeding."
3957
fi
4058
4159
- name: Set up Python 3.11 for CLI

.github/workflows/end-to-end-test-bubblesort-unittest.yaml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: end-to-end-test
22

33
on:
4+
# Use pull_request_target for everything to ensure access to secrets
45
pull_request_target:
6+
paths:
7+
- '**' # Trigger for all paths
8+
59
workflow_dispatch:
610

711
jobs:
812
bubble-sort-optimization-unittest:
9-
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+
}}
1021
runs-on: ubuntu-latest
1122
env:
1223
CODEFLASH_AIS_SERVER: prod
@@ -24,18 +35,25 @@ jobs:
2435
token: ${{ secrets.GITHUB_TOKEN }}
2536
- name: Validate PR
2637
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."
38+
# Check for any workflow changes
39+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
40+
echo "⚠️ Workflow changes detected."
3041
31-
# Check if the PR author is allowed
42+
# Get the PR author
3243
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
44+
echo "PR Author: $AUTHOR"
45+
46+
# Allowlist check
47+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
48+
echo "✅ Authorized user ($AUTHOR). Proceeding."
49+
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
50+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3651
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
52+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
53+
exit 1
3854
fi
55+
else
56+
echo "✅ No workflow file changes detected. Proceeding."
3957
fi
4058
4159
- name: Set up Python 3.11 for CLI

.github/workflows/end-to-end-test-coverage.yaml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: Coverage E2E
22

33
on:
4+
# Use pull_request_target for everything to ensure access to secrets
45
pull_request_target:
6+
paths:
7+
- '**' # Trigger for all paths
8+
59
workflow_dispatch:
610

711
jobs:
812
end-to-end-test-coverage:
9-
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+
}}
1021
runs-on: ubuntu-latest
1122
env:
1223
CODEFLASH_AIS_SERVER: prod
@@ -22,18 +33,25 @@ jobs:
2233
token: ${{ secrets.GITHUB_TOKEN }}
2334
- name: Validate PR
2435
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."
36+
# Check for any workflow changes
37+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
38+
echo "⚠️ Workflow changes detected."
2839
29-
# Check if the PR author is allowed
40+
# Get the PR author
3041
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
42+
echo "PR Author: $AUTHOR"
43+
44+
# Allowlist check
45+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
46+
echo "✅ Authorized user ($AUTHOR). Proceeding."
47+
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
48+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3449
else
35-
echo "Authorized user ($AUTHOR). Proceeding."
50+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
51+
exit 1
3652
fi
53+
else
54+
echo "✅ No workflow file changes detected. Proceeding."
3755
fi
3856
3957
- name: Set up Python 3.11 for CLI

.github/workflows/end-to-end-test-futurehouse.yaml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: end-to-end-test
22

33
on:
4+
# Use pull_request_target for everything to ensure access to secrets
45
pull_request_target:
6+
paths:
7+
- '**' # Trigger for all paths
8+
59
workflow_dispatch:
610

711
jobs:
812
futurehouse-structure:
9-
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+
}}
1021
runs-on: ubuntu-latest
1122
env:
1223
CODEFLASH_AIS_SERVER: prod
@@ -24,18 +35,25 @@ jobs:
2435
token: ${{ secrets.GITHUB_TOKEN }}
2536
- name: Validate PR
2637
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."
38+
# Check for any workflow changes
39+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
40+
echo "⚠️ Workflow changes detected."
3041
31-
# Check if the PR author is allowed
42+
# Get the PR author
3243
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
44+
echo "PR Author: $AUTHOR"
45+
46+
# Allowlist check
47+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
48+
echo "✅ Authorized user ($AUTHOR). Proceeding."
49+
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
50+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3651
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
52+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
53+
exit 1
3854
fi
55+
else
56+
echo "✅ No workflow file changes detected. Proceeding."
3957
fi
4058
4159
- name: Set up Python 3.11 for CLI

.github/workflows/end-to-end-test-init-optim.yaml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
name: end-to-end-test
22

33
on:
4+
# Use pull_request_target for everything to ensure access to secrets
45
pull_request_target:
6+
paths:
7+
- '**' # Trigger for all paths
58
workflow_dispatch:
69

710
jobs:
811
init-optimization:
9-
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+
}}
1020
runs-on: ubuntu-latest
1121
env:
1222
CODEFLASH_AIS_SERVER: prod
@@ -24,18 +34,25 @@ jobs:
2434
token: ${{ secrets.GITHUB_TOKEN }}
2535
- name: Validate PR
2636
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."
37+
# Check for any workflow changes
38+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
39+
echo "⚠️ Workflow changes detected."
3040
31-
# Check if the PR author is allowed
41+
# Get the PR author
3242
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
43+
echo "PR Author: $AUTHOR"
44+
45+
# Allowlist check
46+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
47+
echo "✅ Authorized user ($AUTHOR). Proceeding."
48+
elif [["${{ github.event.pull_request.state }}" == "open" ]]; then
49+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3650
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
51+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
52+
exit 1
3853
fi
54+
else
55+
echo "✅ No workflow file changes detected. Proceeding."
3956
fi
4057
4158
- name: Set up Python 3.11 for CLI

0 commit comments

Comments
 (0)