bundlesize
bundlesize copied to clipboard
Not working on GitHub Actions?
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
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
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 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 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 It is in the last successful (green-checked) action.
https://github.com/redux-saga/redux-saga/commit/8a6bad5628ac4581256b3433a993568b9879f62f/checks?check_suite_id=263713967
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.
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
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 😄
Ah, I see! Anything we can do to help? @siddharthkp
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 😅
Hey @siddharthkp , could we kickstart the development with the volunteers around ? Thanks 🙏
@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
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.
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