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

[Actions] Only use Formula/*.rb files from PRs #48919

Closed

Conversation

@issyl0
Copy link
Member

issyl0 commented Jan 12, 2020

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

  • Sometimes, we update a formula and its alias at the same time. In that
    case, the updated formula could have bottle :unneeded, but the number
    of files in the PR and the number of labels wouldn't match. However we
    still want the "no bottles" label, because there's only one formula in
    the PR.
  • To avoid this, only operate on files in the PR that are in the
    Formula dir.
  • Fixes #48911 (comment).
- Sometimes, we update a formula and its alias at the same time. In that
  case, the updated formula could have `bottle :unneeded`, but the number
  of files in the PR and the number of labels wouldn't match. However we
  still want the "no bottles" label, because there's only one _formula_ in
  the PR.
- To avoid this, only operate on files in the PR that are in the
  `Formula` dir.
- Fixes #48911 (comment).
@issyl0 issyl0 requested a review from bayandin Jan 12, 2020
- After seeing this in the wild on actual PRs, I feel that this is more
  confusing to users than it's worth for us. We can either see the labels,
  or we can't, and the 'mixture of bottled and unbottled formulae' doesn't
  apply to new formulae PRs.
@issyl0

This comment has been minimized.

Copy link
Member Author

issyl0 commented Jan 12, 2020

This won't actually work.

https://github.com/Homebrew/homebrew-core/pull/48927/checks?check_run_id=385796462 shows a failure when it tries to write the label to the PR using GITHUB_TOKEN on a PR from a fork.

GitHub doesn't allow forked repos to have secrets, yet.

@issyl0 issyl0 closed this Jan 12, 2020
@issyl0 issyl0 deleted the issyl0:fix-bug-with-formula-labelling-action branch Jan 12, 2020
issyl0 added a commit to issyl0/homebrew-core that referenced this pull request Jan 12, 2020
- I forgot that GitHub doesn't support [until there was a legitimate use case
  for adding a label](Homebrew#48927),
  so the action will fail:

```
/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/gems/octokit-4.15.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/Homebrew/homebrew-core/issues/48927/labels: 403 - Resource not accessible by integration // See: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue (Octokit::Forbidden)
```

- Given our PR workflow is "forked repo for everything", we can't do this until
  GitHub supports using secrets in forked PRs. It's a [requested
  feature](https://github.community/t5/GitHub-Actions/how-to-use-GITHUB-TOKEN-for-PRs-from-forks/td-p/37450).
- Maybe at some other point in the future, we can revisit this and other
  auto-labelling actions.
- I enjoyed making it nonetheless, and now I have "forked repos" to add to my
  testing for future Actions proof-of-concepts!

----

Reverts Homebrew#48911 and supersedes Homebrew#48919.
issyl0 added a commit that referenced this pull request Jan 12, 2020
…ed` (#48929)

- I forgot that GitHub doesn't support secrets in Actions from forked repos, [until there was a legitimate use case for adding a label](#48927), so the action will fail:

```
/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/gems/octokit-4.15.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/Homebrew/homebrew-core/issues/48927/labels: 403 - Resource not accessible by integration // See: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue (Octokit::Forbidden)
```

- Given our PR workflow is "forked repo for everything", we can't do this until
  GitHub supports using secrets in forked PRs. It's a [requested
  feature](https://github.community/t5/GitHub-Actions/how-to-use-GITHUB-TOKEN-for-PRs-from-forks/td-p/37450).
- Maybe at some other point in the future, we can revisit this and other
  auto-labelling actions.
- I enjoyed making it nonetheless, and now I have "forked repos" to add to my
  testing for future Actions proof-of-concepts!

----

Reverts #48911 and supersedes #48919.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.