Skip to content

Commit

Permalink
ci(pr-validation): set merge commit ref to PR checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwlad90 committed Feb 1, 2025
1 parent 01a889d commit dda9b92
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,24 @@ jobs:
repository-projects: write

steps:
- name: Checkout code
- uses: actions/github-script@v6
if: github.event.pull_request.number != null
id: pr
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.payload.pull_request.number,
});
return pullRequest
- name: Checkout PR code
if: github.event.pull_request.number != null
uses: actions/checkout@v4
with:
ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}}

- name: Checkout branch code
if: github.event.pull_request.number == null
uses: actions/checkout@v4

- name: Setup environment
Expand Down

0 comments on commit dda9b92

Please sign in to comment.