Skip to content

Catching 404 response when calling github.rest.repos.getReleaseByTag() #468

Answered by thomasleplus
thomasleplus asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @joshmgross,

Thanks, you've pointed me in the right direction. With the code that you've posted, the step was still failing with an HttpError but then I noticed an extra message: Promise { <pending> }. I believe the issue is that getReleaseByTag() returns a Promise and so I modified your code like this and it seems to work now:

- name: Check if release already exists
  if: env.VERSION != ''
  uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
  id: check-release
  with:
    script: |
      const { VERSION } = process.env
      return github.rest.repos.getReleaseByTag({
        owner: context.repo.owner,
        repo: context.repo.repo,
        tag: `v${VERSIO…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by thomasleplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants