Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Error reporting could be improved #2

Open
iggy opened this issue Oct 11, 2019 · 18 comments
Open

Error reporting could be improved #2

iggy opened this issue Oct 11, 2019 · 18 comments
Labels
enhancement New feature or request

Comments

@iggy
Copy link

iggy commented Oct 11, 2019

I looked at the code for this action, but I'm not great with the javascript, so not sure I can fix it myself.

When I use this action in one of my workflows and the action receives an error from the github API, it doesn't bubble enough info from the API.

f.ex.

Create Release
Run actions/create-release@v1.0.0
with:
  tag_name: 7e80c809f34b653a75d675520a69e3295861f68a
  release_name: Release 7e80c809f34b653a75d675520a69e3295861f68a
  draft: false
  prerelease: false
env:
  GOROOT: /opt/hostedtoolcache/go/1.12.10/x64
  GITHUB_TOKEN: ***
##[error]Validation Failed
##[error]Node run failed with exit code 1

From what I can tell the API should be returning an HTTP status code along with a JSON body that has more info like so

422 Validation Failed [{Resource:Release Field:target_commitish Code:invalid Message:}]

It would be nice if the content of that JSON body could somehow be bubbled up to the user in the Actions interface.

@IAmHughes IAmHughes self-assigned this Oct 13, 2019
@IAmHughes IAmHughes added the enhancement New feature or request label Oct 13, 2019
@IAmHughes
Copy link
Contributor

Hi @iggy,

Thanks for bringing this up! I wanted to respond briefly to let you know I'll be looking into this. I believe there is a way to see additional debug messages in your Action runner, but I need to verify how that works. Once that's done, I can try to add additional debug messaging that would allow you to see the full payload and response. This would be similar to a "log level" where you enable debug logs, then disable them later if you want to reduce the amount of "noise" in the output.

I'll be taking a look this week to see what I can do! 🎉

@IAmHughes
Copy link
Contributor

Hey @iggy.

Did some research and I think I found a solution for you. You can turn on additional debugging by adding the following two secrets to your repository's settings:

ACTIONS_RUNNER_DEBUG = true
ACTIONS_STEP_DEBUG = true

This will also give you additional logging for things like the payload that triggered the Workflow, which would be in the contextData object as shown below.

"contextData": {
    ...
}

These steps are documented in this repo, and there is some relevant help documentation as well.

Let me know if that helps, and if you have more questions I'll see what I can do to throw additional debugging in. 👍

@Trass3r
Copy link

Trass3r commented Nov 20, 2019

I consider this a serious bug rather than an enhancement request.
You always get that Validation Failed error no matter what happened (e.g. release already exists #12). I wasted a lot of time because I thought the token was expired (secrets.GITHUB_TOKEN does that after 1h!).

@Trass3r
Copy link

Trass3r commented Nov 20, 2019

ACTIONS_RUNNER_DEBUG = true
ACTIONS_STEP_DEBUG = true

Even with that I don't see any useful output: https://github.com/Trass3r/testgithubactionsrelease/runs/311483971

@jakelacey2012
Copy link

Any progress on this issue, its really unclear why this is failing

      - uses: actions/create-release@v1

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

        with:
          tag_name: ${{ github.sha }}
          release_name: Release ${{ github.sha }}
          draft: false
          prerelease: false

@Cubxity
Copy link

Cubxity commented Jan 2, 2020

@jakelacey2012 I had the same issue, you can't have the tag name as same as a commit

@sergeyklay
Copy link

sergeyklay commented Jan 15, 2020

Run actions/create-release@v1.0.0
  with:
    tag_name: refs/tags/ignore-0.12.16-3
    release_name: Release refs/tags/ignore-0.12.16-3
    body: All notable changes to this version has been documented in the CHANGELOG.md file.
  
    draft: true
    prerelease: false
  env:
    BOX_VERSION: 3.8.4
    GITHUB_TOKEN: ***
##[error]Not Found
##[error]Node run failed with exit code 1

I have no idea what means "Not Found". And I'm pretty sure the tag is exists. I can even use something like cat ".git/${{ github.ref }}" in the same workflow and I can see the SHA.

sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
@sergeyklay
Copy link

@IAmHughes Is this output tell me something useful?

##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'ref'
##[debug]..=> 'refs/tags/ignore-0.12.16-4'
##[debug]=> 'Release refs/tags/ignore-0.12.16-4'
##[debug]Result: 'Release refs/tags/ignore-0.12.16-4'
##[debug]Loading env
##[debug]Evaluating: secrets.GH_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'GH_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'

sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Jan 15, 2020
@sergeyklay
Copy link

sergeyklay commented Jan 15, 2020

In my case the issue was related due to wrong token ussage (I created yet one in the secrets). You don't need to create your own token.

@sebastianfeldmann
Copy link

I got the following

Run actions/create-release@v1.0.0
##[error]Not Found
##[error]Node run failed with exit code 1

Could solve it with a different token with more access rights.

Could you please document what kind of permissions the token needs and improve the error message so others don't run into the same problem.

swaroopch added a commit to swaroopch/byte-of-python that referenced this issue Jan 23, 2020
@rosuH
Copy link

rosuH commented Mar 6, 2020

Maybe you're creating a duplicated name's release. I Change name to timestamp and works fine.

@szul
Copy link

szul commented Mar 27, 2020

@Cubxity Why can't you have a tag name the same as a commit? For CI/CD, you need a unique tag name to grab the assets for deployment on the other end, yet you can't necessarily use semantic versioning all the time if you're doing CI/CD in a dev environment multiple times a day. What unique identifier can you use the GitHub event?

@szul
Copy link

szul commented Mar 29, 2020

Received an answer from a GitHub employee on Twitter: You can use the GITHUB_RUN_ID variable for a unique identifier for non-semvar tags/releases.

@kousu
Copy link

kousu commented Apr 14, 2020

(with ACTIONS_STEP_DEBUG = true set and) With this step

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.sha }}
          release_name: Release ${{ github.sha }}
          draft: false
          prerelease: false

I was getting

##[group]Run actions/create-release@v1
with:
  tag_name: 46e825c34438558d9789da3d067cf4ff45cd18f5
  release_name: Release 46e825c34438558d9789da3d067cf4ff45cd18f5
  draft: false
  prerelease: false
env:
  GITHUB_TOKEN: ***
##[endgroup]
##[error]Validation Failed
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Create Release

Thanks to @Cubxity I fixed it by prefixing my release ID with binaries-:

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: binaries-${{ github.sha }}
          release_name: Release ${{ github.sha }}
          draft: false
          prerelease: false

@kousu
Copy link

kousu commented Apr 14, 2020

I tried @szul's research but it failed; maybe I misunderstood?

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.GITHUB_RUN_ID }}
          release_name: Release ${{ github.sha }}
          draft: false
          prerelease: false
##[group]Run actions/create-release@v1
with:
  release_name: Release 7c41ed45657eeaa16cb77adf35e219a4cf696291
  draft: false
  prerelease: false
env:
  GITHUB_TOKEN: ***
##[endgroup]
##[error]Input required and not supplied: tag_name
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Create Release

If you are using git tags, and only running this on master, and moreover only merging to master on new tags, then then this glitch would never show up, since there would only ever be one run per tag. It seems really easy to to trip over, having a better error message with the details would really help.

@szul
Copy link

szul commented Apr 14, 2020

@kousu Had to output it this way:

- name: Create Release
   id: create_release
   uses: actions/create-release@latest
   env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   with:
     tag_name: dev-lms-${{ github.run_id }}
     release_name: Release dev-lms-${{ github.run_id }}
     draft: false
     prerelease: false

@kousu
Copy link

kousu commented Apr 14, 2020

Amazing, thanks :)

@kousu
Copy link

kousu commented Apr 14, 2020

@sondreb's work from #29, https://github.com/sondreb/action-release, seems much more like what I want: I want to have an auto-generated draft release, always updated with the latest build, and then I want to manually switch it to published when I am satisfied at which point it should be frozen.

sergeyklay added a commit to sergeyklay/gh-actions-php-phar-create-release-example that referenced this issue Apr 26, 2020
sergeyklay added a commit to sergeyklay/gh-actions-php-phar-create-release-example that referenced this issue Apr 26, 2020
sergeyklay added a commit to zephir-lang/zephir that referenced this issue Apr 26, 2020
mscoutermarsh pushed a commit that referenced this issue Jul 1, 2020
body_path missing from action.yml
@IAmHughes IAmHughes removed their assignment Aug 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants