Skip to content

Commit 6dee4eb

Browse files
Saga4KRRT7
authored andcommitted
fix PR approved state (#134)
* fix PR approved state * fix topological sort wf
1 parent 8c6869e commit 6dee4eb

8 files changed

+120
-68
lines changed

.github/workflows/codeflash-optimize.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,25 @@ jobs:
2929
fetch-depth: 0
3030
- name: Validate PR
3131
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."
32+
# Check for any workflow changes
33+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
34+
echo "⚠️ Workflow changes detected."
3535
36-
# Check if the PR author is allowed
36+
# Get the PR author
3737
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
38+
echo "PR Author: $AUTHOR"
39+
40+
# Allowlist check
41+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
42+
echo "✅ Authorized user ($AUTHOR). Proceeding."
43+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
44+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
4145
else
42-
echo "Authorized user ($AUTHOR). Proceeding."
46+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
47+
exit 1
4348
fi
49+
else
50+
echo "✅ No workflow file changes detected. Proceeding."
4451
fi
4552
4653
- name: 🐍 Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ jobs:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Validate PR
2626
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."
27+
# Check for any workflow changes
28+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
29+
echo "⚠️ Workflow changes detected."
3030
31-
# Check if the PR author is allowed
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
35+
# Allowlist check
36+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
37+
echo "✅ Authorized user ($AUTHOR). Proceeding."
38+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
39+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3640
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
41+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
42+
exit 1
3843
fi
44+
else
45+
echo "✅ No workflow file changes detected. Proceeding."
3946
fi
4047
4148
- name: Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ jobs:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Validate PR
2626
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."
27+
# Check for any workflow changes
28+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
29+
echo "⚠️ Workflow changes detected."
3030
31-
# Check if the PR author is allowed
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
35+
# Allowlist check
36+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
37+
echo "✅ Authorized user ($AUTHOR). Proceeding."
38+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
39+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3640
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
41+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
42+
exit 1
3843
fi
44+
else
45+
echo "✅ No workflow file changes detected. Proceeding."
3946
fi
4047
4148
- name: Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,25 @@ jobs:
2222
token: ${{ secrets.GITHUB_TOKEN }}
2323
- name: Validate PR
2424
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."
25+
# Check for any workflow changes
26+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
27+
echo "⚠️ Workflow changes detected."
2828
29-
# Check if the PR author is allowed
29+
# Get the PR author
3030
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
31+
echo "PR Author: $AUTHOR"
32+
33+
# Allowlist check
34+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
35+
echo "✅ Authorized user ($AUTHOR). Proceeding."
36+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
37+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3438
else
35-
echo "Authorized user ($AUTHOR). Proceeding."
39+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
40+
exit 1
3641
fi
42+
else
43+
echo "✅ No workflow file changes detected. Proceeding."
3744
fi
3845
3946
- name: Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ jobs:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Validate PR
2626
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."
27+
# Check for any workflow changes
28+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
29+
echo "⚠️ Workflow changes detected."
3030
31-
# Check if the PR author is allowed
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
35+
# Allowlist check
36+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
37+
echo "✅ Authorized user ($AUTHOR). Proceeding."
38+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
39+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3640
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
41+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
42+
exit 1
3843
fi
44+
else
45+
echo "✅ No workflow file changes detected. Proceeding."
3946
fi
4047
4148
- name: Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ jobs:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Validate PR
2626
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."
27+
# Check for any workflow changes
28+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
29+
echo "⚠️ Workflow changes detected."
3030
31-
# Check if the PR author is allowed
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
35+
# Allowlist check
36+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
37+
echo "✅ Authorized user ($AUTHOR). Proceeding."
38+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
39+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3640
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
41+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
42+
exit 1
3843
fi
44+
else
45+
echo "✅ No workflow file changes detected. Proceeding."
3946
fi
4047
4148
- name: Set up Python 3.11 for CLI

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@ jobs:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
- name: Validate PR
2626
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."
27+
# Check for any workflow changes
28+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
29+
echo "⚠️ Workflow changes detected."
3030
31-
# Check if the PR author is allowed
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
35+
# Allowlist check
36+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
37+
echo "✅ Authorized user ($AUTHOR). Proceeding."
38+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
39+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3640
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
41+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
42+
exit 1
3843
fi
44+
else
45+
echo "✅ No workflow file changes detected. Proceeding."
3946
fi
4047
4148

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424
token: ${{ secrets.GITHUB_TOKEN }}
25+
2526
- name: Validate PR
2627
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
28+
# Check for any workflow changes
29+
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
30+
echo "⚠️ Workflow changes detected."
31+
# Get the PR author
3232
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
33+
echo "PR Author: $AUTHOR"
34+
# Allowlist check
35+
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
36+
echo "✅ Authorized user ($AUTHOR). Proceeding."
37+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
38+
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
3639
else
37-
echo "Authorized user ($AUTHOR). Proceeding."
40+
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
41+
exit 1
3842
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
43+
else
44+
echo "✅ No workflow file changes detected. Proceeding."
4245
fi
4346
4447
- name: Set up Python 3.11 for CLI

0 commit comments

Comments
 (0)