Skip to content

Commit

Permalink
ci: add checks for commit SHAs
Browse files Browse the repository at this point in the history
  • Loading branch information
anitarua committed Jan 13, 2025
1 parent 1a44a5d commit 693bab6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ jobs:
echo "Job originally triggered by ${{ github.actor }}"
exit 1
check-commits-exists:
needs: verify-user-permissions
runs-on: ubuntu-latest
steps:
- name: Check if merge commit sha exists
if: github.event.pull_request.merge_commit_sha == ''
run: |
echo "No merge commit sha found for this pull request."
exit 1
- name: Check if head sha exists
if: github.event.pull_request.head.sha == ''
run: |
echo "No head sha found for this pull request."
exit 1
checkout-default:
needs: verify-user-permissions
name: Checkout action using default ref
Expand Down Expand Up @@ -53,7 +69,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
ref: ${{ github.event.pull_request.merge_commit_sha || github.event.pull_request.head.sha }}

- name: Test secret access
if: env.SUPER_SECRET == ''
Expand Down

0 comments on commit 693bab6

Please sign in to comment.