Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundlewatch Github status not working? #220

Open
mrlubos opened this issue Aug 21, 2020 · 11 comments
Open

Bundlewatch Github status not working? #220

mrlubos opened this issue Aug 21, 2020 · 11 comments

Comments

@mrlubos
Copy link

mrlubos commented Aug 21, 2020

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

Bug.

(Slack link above not working btw)

What is the current behavior?

Unable to get Github status check to work with Github actions.

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

Following the official documentation.

  1. Install bundlewatch.
  2. Create config file.
  3. Add BUNDLEWATCH_GITHUB_TOKEN secret to the project.
  4. Add build command and bundlewatch CLI command to my existing Github Actions workflow.
  5. Commit these changes.
  6. Observe everything works and results are saved.
  7. Open a new pull request.
  8. Observe everything works again and the results are diffed against the base branch.
  9. Observe no status check appears on the pull request.

package.json

"size": "bundlewatch --config .bundlewatchrc.json"

.bundlewatchrc.json

{
  "files": [
    {
      "maxSize": "20 KB",
      "path": "build/static/js/*.js"
    }
  ],
  "ci": {
    "trackBranches": ["main"]
  }
}

.github/workflows/workflow.yml

name: workflow

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  webapp:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.3.1
      - run: yarn install --frozen-lockfile
      - run: yarn build
      - run: yarn size
        env:
          BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
          CI_BRANCH_BASE: main

What is the expected behavior?

A failing or succeeding pull request check appears on Github.

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

Please mention other relevant information such as the browser version, Node.js version, bundlewatch version, and Operating System.

Node 12.18.3
bundlewatch 0.2.7

@olegshilov
Copy link

Have the same issue

@sjwilczynski
Copy link

Same issue for me

@iamogbz
Copy link
Member

iamogbz commented Nov 11, 2020

@mrlubos mind providing some logs from when the bundlewatch script is run i.e. yarn size. Might be an issue with the first check not having something to diff against master.

@sjwilczynski
Copy link

@iamogbz I have the same issue. You can see the logs for bundlewatch action running here. The bundlewatch configuration is in the root package.json file.

@indocomsoft
Copy link
Contributor

Same thing is happening to https://github.com/pinda-fun/pinda-fun

@izi-p
Copy link

izi-p commented Jan 19, 2021

Hello I am currently having the same issue, how did you manage to make it work @indocomsoft @mrlubos @sjwilczynski 🙏

@sjwilczynski
Copy link

@izi-p i didn't manage to fix it unfortunately

@izi-p
Copy link

izi-p commented Jan 20, 2021

Somehow it does not work with github actions and the commit that is sent to result page is a weird merge commit instead of the head commit of the pull request.

I managed to fix this by passing manually the commit sha pointing to the head commit of the pull request in my github action

checksize.yml

      - name: Run bundlewatch
        run: yarn bundlewatch --config bundlewatch.config.json
        env:
          BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
          CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}

cc @sjwilczynski

@alexcroox
Copy link

Time for another fork? 😅

@davwheat
Copy link

Same issue here. Can confirm @izi-p's fix worked wonders! Thank you!

crubier added a commit to labelflow/labelflow that referenced this issue Jun 30, 2021
@Filipeue
Copy link

I was about to replace bundlewatch with something else when I found @izi-p comment. It finally works! Thanks m8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants