@@ -1863,16 +1863,18 @@ jobs:
1863
1863
- name : List files in project root
1864
1864
id : project-root
1865
1865
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
1866
+ env :
1867
+ # Use the tip of the pull request branch for pull request (target) events.
1868
+ # Use the event sha for other events.
1869
+ REF : ${{ github.event.pull_request.head.sha || github.sha }}
1866
1870
with :
1867
1871
github-token : ${{ github.token }}
1868
1872
result-encoding : json
1869
- # Use the tip of the pull request branch for pull request (target) events.
1870
- # Use the event sha for other events.
1871
1873
script : |
1872
1874
const { data } = await github.rest.repos.getContent({
1873
1875
owner: context.repo.owner,
1874
1876
repo: context.repo.repo,
1875
- ref: context.payload.pull_request.head.sha || context.ref
1877
+ ref: process.env.REF
1876
1878
});
1877
1879
1878
1880
return data
@@ -1887,18 +1889,19 @@ jobs:
1887
1889
if : inputs.working_directory && inputs.working_directory != '.'
1888
1890
env :
1889
1891
WORKING_DIRECTORY : ${{ inputs.working_directory }}
1892
+ # Use the tip of the pull request branch for pull request (target) events.
1893
+ # Use the event sha for other events.
1894
+ REF : ${{ github.event.pull_request.head.sha || github.sha }}
1890
1895
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
1891
1896
with :
1892
1897
github-token : ${{ github.token }}
1893
1898
result-encoding : json
1894
- # Use the tip of the pull request branch for pull request (target) events.
1895
- # Use the event sha for other events.
1896
1899
# Remove preceeding ./ from the working directory if it exists.
1897
1900
script : |
1898
1901
const { data } = await github.rest.repos.getContent({
1899
1902
owner: context.repo.owner,
1900
1903
repo: context.repo.repo,
1901
- ref: context.payload.pull_request.head.sha || context.ref ,
1904
+ ref: process.env.REF ,
1902
1905
path: process.env.WORKING_DIRECTORY.startsWith('./') ? process.env.WORKING_DIRECTORY.slice(2) : process.env.WORKING_DIRECTORY
1903
1906
});
1904
1907
0 commit comments