bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

Not working on GitHub Actions?

Open gr2m opened this issue 4 years ago • 14 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

When running npx bundlesize in a GitHub Action, I get this warning:

WARN github token not found

You are missing out on some cool features. Read more here: https://github.com/siddharthkp/bundlesize#2-build-status

If the current behavior is a bug, please provide the steps to reproduce.

See output log at See https://github.com/octokit/rest.js/runs/230268601#step:6:6

Configuration:

https://github.com/octokit/rest.js/blob/7e7319208b77cf83eb4c6335c03325befc38901f/.github/workflows/bundlesize.yml#L15-L17

I first had BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} but then changed it to BUNDLESIZE_GITHUB_TOKEN: ${{ secrets.BUNDLESIZE_GITHUB_TOKEN }} with the token provided via the OAuth app.

What is the expected behavior?

It should just work :tm:

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information.

  • node version: 12.10.0
  • npm version: version distributed with Node 12.10.0
  • Operating system: Ubuntu latest
  • bundlesize version: latest, run via npx
  • CI you are using: GitHub Actions

gr2m avatar Sep 20 '19 18:09 gr2m

By the way I'm a maintaner at https://github.com/probot/probot and the JavaScript/Node tools at https://github.com/octokit/, if you have any questions or ideas you would like to discuss regarding integrating with any parts of the GitHub APIs, I'm happy to help

gr2m avatar Sep 20 '19 18:09 gr2m

It seems to work pretty OK with GitHub Actions for me - https://github.com/redux-saga/redux-saga/pull/1952 . Still need to figure out few things regarding actions, but bundlesize's setup is not a problem for me there.

Andarist avatar Oct 14 '19 11:10 Andarist

@Andarist From what I see in your repo, the bundlesize cli is making request to the bundlesize server, but it is getting 500 error response. Is that an expected thing? I am running into the same problem in my repo: https://github.com/jackyef/bundlesize-gh-action/pull/1

jackyef avatar Oct 18 '19 08:10 jackyef

@jackyef where you can see the error? That branch is currently having problems with test script and it doesn't reach the bundlesize step. When it did reach it in the past I haven't seen any problems - the check was green, size reported etc.

Andarist avatar Oct 18 '19 22:10 Andarist

@Andarist It is in the last successful (green-checked) action.

https://github.com/redux-saga/redux-saga/commit/8a6bad5628ac4581256b3433a993568b9879f62f/checks?check_suite_id=263713967

jackyef avatar Oct 19 '19 04:10 jackyef

Interesting - this one https://github.com/redux-saga/redux-saga/commit/a91fe2e6aef8a9bc532e2711b65992e9bc0a59cb/checks?check_suite_id=263313078 has errored OK on the bundlesize check and I remember seeing the status under my PR.

Currently, I'm having problems with yarn/npm running with different node paths - that's why I haven't merged in that PR yet, but gonna look into fixing this and maybe then I'll see what exactly happens with bundlesize.

Andarist avatar Oct 19 '19 07:10 Andarist

Hmm, okay so it did work for you. I thought it was a case of a bad implementation in my part.

Now, I assume that the server (https://bundlesize-store.now.sh/) is currently having issue?

cc: @siddharthkp

jackyef avatar Oct 19 '19 07:10 jackyef

Ugh, yeah. bundlesize-store has been really flaky recently. There are a bunch of problems in how I first implemented in 2 years ago. I'm probably going to rewrite it in November

your patience would be great 😄

siddharthkp avatar Oct 19 '19 11:10 siddharthkp

Ah, I see! Anything we can do to help? @siddharthkp

jackyef avatar Oct 20 '19 04:10 jackyef

You could take up some of the tasks involved in writing that, but that would also take up some effort from my side to get you started

so for a few weeks, please just wait without booing at me 😅

siddharthkp avatar Oct 20 '19 13:10 siddharthkp

Hey @siddharthkp , could we kickstart the development with the volunteers around ? Thanks 🙏

Djiit avatar Jan 23 '20 14:01 Djiit

@Djiit He seems to have too much on his plate at the time 😄

For the time being, I think bundlewatch is a great alternative. I made an action for it as well to make it a little bit easier to use. bundlewatch-gh-action

jackyef avatar Feb 04 '20 15:02 jackyef

Not sure why, and I think this is still a bug, but I think the simplest resolution here is to use on: push instead of on: pull_request -- it will still show up as a status check on PRs.

Broken pull_request: https://github.com/octokit/rest.js/actions/runs/12676607/workflow Working push: https://github.com/redux-saga/redux-saga/pull/1952/files

I did some testing with GitHub Actions, and changing the trigger event was the exact place where it broke in many specific tests.

patcon avatar Jun 23 '20 14:06 patcon

on: push will not work for pull requests coming from forks

Basically you have to make it work without requiring a GitHub token, as repository secrets are not passed to pull requests from forks

gr2m avatar Jun 23 '20 15:06 gr2m