svenstaro / upload-release-action

Upload files to a GitHub release
MIT License
626 stars 110 forks source link

Use the `@file` mechanism of octokit-5 #92

Closed ggreif closed 1 year ago

ggreif commented 1 year ago

Adhere to the Octokit-5 spec:

// Octokit.js
// https://github.com/octokit/core.js#readme
const octokit = new Octokit({
  auth: 'YOUR-TOKEN'
})

await octokit.request('POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}', {
  owner: 'OWNER',
  repo: 'REPO',
  release_id: 'RELEASE_ID',
  data: '@release-asset.gz'
})

TypeScript also insists on filling in the name: slot, so leave that in.

ggreif commented 1 year ago

N.B.: there are warnings (I think unrelated)

/Users/ggreif/motoko/upload-release-action/src/main.ts
   35:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  179:19  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 2 problems (0 errors, 2 warnings)
ggreif commented 1 year ago

@svenstaro this can be merged. CI E2E fails for unknown reasons, but my last PR did the same.

svenstaro commented 1 year ago

Oh man, this is actually much cleaner. Thanks!

svenstaro commented 1 year ago

By the way, the reason the E2E fails is because of permission problems in user-created forks. Not sure how to best fix that. Ideally I'd like to run specific pipelines using my permissions to check them.

svenstaro commented 1 year ago

Hm, doesn't seem to work so well after merging. Could you take a look at that?

ggreif commented 1 year ago

It fails indeed :-( Here are the debug logs: https://github.com/dfinity/motoko/actions/runs/4054155384/jobs/6975721612#step:6:49

I am using the action like this

    - name: Upload Release Assets
      uses: svenstaro/upload-release-action@9927d3f5ec4aad69542d020b27c888bc5dd79251
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        tag: ${{ github.ref }}
        file: result/*
        file_glob: true
        body: ${{ needs.changelog.outputs.release_body }}
ggreif commented 1 year ago

@svenstaro can you re-run the last action with debugging output on? (Vielleicht können wir auch zoom-en?)

Never mind, I found a way to debug the action from my fork, I'll do my homework first.