fix workflow triggering condition (#136)

* fix workflow triggering condition

* fix run
This commit is contained in:
Sarthak Agarwal 2025-04-11 10:34:52 +05:30 committed by GitHub
parent 21f09ab91e
commit 7d7340c124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 34 additions and 6 deletions

View file

@ -1,9 +1,11 @@
name: CodeFlash
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- "**"
- '**' # Trigger for all paths
workflow_dispatch:
concurrency:

View file

@ -1,7 +1,11 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,11 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,11 @@
name: Coverage E2E
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,11 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,10 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,10 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:

View file

@ -1,7 +1,11 @@
name: end-to-end-test
on:
# Use pull_request_target for everything to ensure access to secrets
pull_request_target:
paths:
- '**' # Trigger for all paths
workflow_dispatch:
jobs:
@ -23,7 +27,7 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate PR
- name: Validate PR for workflow changes
run: |
# Check for any workflow changes
if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" | grep -q "^.github/workflows/"; then
@ -34,8 +38,8 @@ jobs:
# Allowlist check
if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then
echo "✅ Authorized user ($AUTHOR). Proceeding."
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ github.event.pull_request.state }}" == "open" ]]; then
echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding."
elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then
echo "✅ PR is open. Assuming protection rules are in place. Proceeding."
else
echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting."
exit 1

View file

@ -24,9 +24,9 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo
});
const labelExists = labels.data.some(label => label.name === labelName);
if (!labelExists) {
// Create the label if it doesn't exist
await github.rest.issues.createLabel({