Skip to content

Commit 5a4a547

Browse files
committed
fix ci
1 parent ee15d8c commit 5a4a547

8 files changed

+63
-9
lines changed

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

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: end-to-end-test
22

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

711
jobs:
812
benchmark-bubble-sort-optimization:
13+
# Dynamically determine if environment is needed only when workflow files change and contributor is external
14+
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' || '' }}
15+
916
runs-on: ubuntu-latest
1017
env:
1118
CODEFLASH_AIS_SERVER: prod
@@ -17,11 +24,37 @@ jobs:
1724
EXPECTED_IMPROVEMENT_PCT: 5
1825
CODEFLASH_END_TO_END: 1
1926
steps:
20-
- uses: actions/checkout@v4
27+
- name: 🛎️ Checkout
28+
uses: actions/checkout@v4
2129
with:
30+
ref: ${{ github.event.pull_request.head.ref }}
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2232
fetch-depth: 0
2333
token: ${{ secrets.GITHUB_TOKEN }}
2434

35+
- name: Validate PR
36+
run: |
37+
# Check for any workflow changes
38+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then
39+
echo "⚠️ Workflow changes detected."
40+
41+
# Get the PR author
42+
AUTHOR="${{ github.event.pull_request.user.login }}"
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."
50+
else
51+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
52+
exit 1
53+
fi
54+
else
55+
echo "✅ No workflow file changes detected. Proceeding."
56+
fi
57+
2558
- name: Set up Python 3.11 for CLI
2659
uses: astral-sh/setup-uv@v5
2760
with:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ jobs:
2424
EXPECTED_IMPROVEMENT_PCT: 300
2525
CODEFLASH_END_TO_END: 1
2626
steps:
27-
- uses: actions/checkout@v4
27+
- name: 🛎️ Checkout
28+
uses: actions/checkout@v4
2829
with:
30+
ref: ${{ github.event.pull_request.head.ref }}
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2932
fetch-depth: 0
3033
token: ${{ secrets.GITHUB_TOKEN }}
3134
- name: Validate PR

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ jobs:
2424
EXPECTED_IMPROVEMENT_PCT: 300
2525
CODEFLASH_END_TO_END: 1
2626
steps:
27-
- uses: actions/checkout@v4
27+
- name: 🛎️ Checkout
28+
uses: actions/checkout@v4
2829
with:
30+
ref: ${{ github.event.pull_request.head.ref }}
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2932
fetch-depth: 0
3033
token: ${{ secrets.GITHUB_TOKEN }}
3134
- name: Validate PR

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ jobs:
2222
RETRY_DELAY: 5
2323
CODEFLASH_END_TO_END: 1
2424
steps:
25-
- uses: actions/checkout@v4
25+
- name: 🛎️ Checkout
26+
uses: actions/checkout@v4
2627
with:
28+
ref: ${{ github.event.pull_request.head.ref }}
29+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2730
fetch-depth: 0
2831
token: ${{ secrets.GITHUB_TOKEN }}
2932
- name: Validate PR

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ jobs:
2424
EXPECTED_IMPROVEMENT_PCT: 10
2525
CODEFLASH_END_TO_END: 1
2626
steps:
27-
- uses: actions/checkout@v4
27+
- name: 🛎️ Checkout
28+
uses: actions/checkout@v4
2829
with:
30+
ref: ${{ github.event.pull_request.head.ref }}
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2932
fetch-depth: 0
3033
token: ${{ secrets.GITHUB_TOKEN }}
3134
- name: Validate PR

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ jobs:
2323
EXPECTED_IMPROVEMENT_PCT: 300
2424
CODEFLASH_END_TO_END: 1
2525
steps:
26-
- uses: actions/checkout@v4
26+
- name: 🛎️ Checkout
27+
uses: actions/checkout@v4
2728
with:
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2831
fetch-depth: 0
2932
token: ${{ secrets.GITHUB_TOKEN }}
3033
- name: Validate PR

.github/workflows/end-to-end-test-tracer-replay.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ jobs:
2323
EXPECTED_IMPROVEMENT_PCT: 10
2424
CODEFLASH_END_TO_END: 1
2525
steps:
26-
- uses: actions/checkout@v4
26+
- name: 🛎️ Checkout
27+
uses: actions/checkout@v4
2728
with:
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2831
fetch-depth: 0
2932
token: ${{ secrets.GITHUB_TOKEN }}
3033
- name: Validate PR

.github/workflows/end-to-end-topological-sort-test.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ jobs:
2323
EXPECTED_IMPROVEMENT_PCT: 5
2424
CODEFLASH_END_TO_END: 1
2525
steps:
26-
- uses: actions/checkout@v4
26+
- name: 🛎️ Checkout
27+
uses: actions/checkout@v4
2728
with:
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2831
fetch-depth: 0
2932
token: ${{ secrets.GITHUB_TOKEN }}
3033
- name: Debug Environment Decision

0 commit comments

Comments
 (0)