ModusCreateOrg / gimbal

Web Performance Auditing tooling
https://labs.moduscreate.com/gimbal-web-performance-audit-budgeting
MIT License
115 stars 8 forks source link

Github Comment not appearing #163

Closed camposcristian closed 4 years ago

camposcristian commented 4 years ago

Describe the bug For some reason, the comment in the PR of github is not appearing To Reproduce Steps to reproduce the behavior:

  1. Created the workflow
  2. Set the .yml config file with the verbose log
  3. Execute the workflow after a commit

Expected behavior Log said that comment should appear but for some reason is not on the PR.

Screenshots image

Additional context Logs with verbose comments:

├────────────────────────────────────────────────────────┼───────────┼───────────┼─────────┤
│ SEO                                                    │    90     │    90     │    ✓    │
├────────────────────────────────────────────────────────┼───────────┼───────────┼─────────┤
│ Progressive Web App                                    │    52     │    52     │    ✓    │
└────────────────────────────────────────────────────────┴───────────┴───────────┴─────────┘
HTML report written to: /github/workspace/gimbal-artifacts/results.html
JSON report written to: /github/workspace/gimbal-artifacts/results.json
Markdown report written to: /github/workspace/gimbal-artifacts/results.md
gimbal/vcs/comment [2020-04-15T06:20:55.378Z] Detected CI: GitHubActions
gimbal/vcs/comment [2020-04-15T06:20:55.390Z] Detected VCS: GitHub
gimbal/vcs/comment [2020-04-15T06:20:55.405Z] Commenting on VCS...
grgur commented 4 years ago

Hi @camposcristianeze, thanks for that question. Do you have GITHUB_AUTH_TOKEN environmental variable in you CI settings? The value should be the personal token (GitHub) for a user that has privileges to comment on the project.

camposcristian commented 4 years ago

Thanks for the answer @grgur . Realised that the comments were working, but they are appearing as commit comments. Any way to add them as comments on a PR instead?

image

This is our current action:

name: Pull Request Deploy
on:
  pull_request:
    branches:
      - staging
      - master
jobs:
gimbal:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the code
        uses: actions/checkout@v1
        with:
          fetch-depth: 1
      - name: Install node
        uses: actions/setup-node@v1
        with:
          node-version: '12.x'
      - name: Install yarn dependencies
        run: yarn
      - name: Build
        env:
          CI: ''
        run: yarn build
      - name: Performance Budgeting Regression Testing
        uses: ModusCreateOrg/gimbal/action@master
        env:
          GITHUB_AUTH_TOKEN: ${{ secrets.GIMBAL_GITHUB_TOKEN }}
mitchellsimoens commented 4 years ago

As of when the last publish of gimbal, GitHub actions does not provide the PR number so the only option is to use the commit sha and comment on that commit. I also feel it has value to comment the run result on the commit to connect the run and the log.

This being said, it is my experience that commenting on a commit will be displayed in the pull request view. For example all the commit comments on this PR: #159

camposcristian commented 4 years ago

That makes sense.. The thing is that comments are only appearing only in merges that I can't figure out where they are coming from. image

🤔 Maybe because we set this for:

on:
  pull_request:
    branches:
      - staging
      - master

instead of

on: [push]

I'll have a look and let you know!

mitchellsimoens commented 4 years ago

The issue with using the pull_request type is that it’s not going to run your workflow when you likely want it to. It will only run when a PR is opened or closed or when it’s edited like when you add a label or assign it to someone. You likely want gimbal to run when you push a commit which the pull_request type won’t get triggered akaik.

grgur commented 4 years ago

Hi @camposcristianeze! I'm curious, did @mitchellsimoens's suggestion work for you?

camposcristian commented 4 years ago

Got it working like a charm! Thanks @mitchellsimoens @grgur