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

only supports being run on "[pull_request]" #6

Closed
gavinsharp opened this issue Feb 19, 2020 · 3 comments · Fixed by #7
Closed

only supports being run on "[pull_request]" #6

gavinsharp opened this issue Feb 19, 2020 · 3 comments · Fixed by #7

Comments

@gavinsharp
Copy link
Contributor

Thanks for the cool action!

I tried adding it on my existing push-triggered workflow, and got a confusing error on my first try:

Run preactjs/compressed-size-action@v1
  with:
    repo-token: ***
    build-script: build
    show-total: true
    collapse-unchanged: true
##[error]Cannot read property 'base' of undefined

Looking into the code, it appears to be because the action depends on context.payload.pull_request:

const pr = context.payload.pull_request;

which presumably doesn't exist on push-triggered workflows.

I wanted the action run on push because a PR can go through multiple iterations and I wanted the compressed size reported for every iteration.

Ideal would be to support both types of triggers (it appears there is some commented out code to use the octokit API to fetch PR data), but at the very least it would be nice to fail a bit more gracefully (with a clearer error message).

@gavinsharp gavinsharp changed the title only supports being run on "[pull request]" only supports being run on "[pull_request]" Feb 19, 2020
@developit
Copy link
Member

I'd like to support push workflows here too. FWIW, when your PR goes through multiple iterations, you can see the history of each commit's builds by looking at Github's "edit history" for the size action comment. It holds a log of every size delta produced, each compared to the PR base. To me this seems preferable, since I rarely want to see each commit's delta from the previous commit.

@gavinsharp
Copy link
Contributor Author

FWIW, when your PR goes through multiple iterations, you can see the history of each commit's builds by looking at Github's "edit history" for the size action comment. It holds a log of every size delta produced, each compared to the PR base. To me this seems preferable, since I rarely want to see each commit's delta from the previous commit.

Hmm, I think I misunderstood how the pull_request trigger works. I assumed it only ran on PR creation.

@gavinsharp
Copy link
Contributor Author

Thanks for the quick response!

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

Successfully merging a pull request may close this issue.

2 participants