File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,19 @@ jobs:
34
34
uses : actions/github-script@v6
35
35
with :
36
36
script : |
37
- const { data: { object: { sha } } } = await github.rest.git.getRef({
38
- owner: context.repo.owner,
39
- repo: context.repo.repo,
40
- ref: 'heads/release'
41
- })
37
+ const sha = await (async () => {
38
+ try {
39
+ return (await github.rest.git.getRef({
40
+ owner: context.repo.owner,
41
+ repo: context.repo.repo,
42
+ ref: 'heads/release'
43
+ })).data.object.sha
44
+ } catch (e) {
45
+ // If the ref does not exist, use an undefined `sha`
46
+ if (e?.status === 404) return undefined
47
+ throw e
48
+ }
49
+ })()
42
50
43
51
if (sha !== '${{ github.sha }}') {
44
52
console.log(`Trying to update the 'release' branch by fast-forwarding to 'main' in ${context.repo.owner}/${context.repo.repo}`)
You can’t perform that action at this time.
0 commit comments