-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add api_url
parameter to create_release_backmerge_pull_request
#641
base: trunk
Are you sure you want to change the base?
Conversation
62eb6eb
to
c18308c
Compare
FastlaneCore::ConfigItem.new(key: :api_url, | ||
description: 'The GitHub API URL to use for creating the pull request. Primarily used when working with GitHub Enterprise instances', | ||
optional: true, | ||
type: String), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it'd make more sense to reference the ConfigItem
from the original create_pull_request
action, filtering on the parameters we want to just forward, instead of duplicating them (and tiehr optional
. description
, type
,…) ourselves?
i.e.
FORWARDED_PARAM_KEYS = %i[api_token api_bearer repo labels api_url assignees reviewers team_reviewers].freeze
def self.available_options
forwarded_params = Fastlane::Actions::CreatePullRequestAction.available_options.select do |opt|
FORWARDED_PARAM_KEYS.include?(opt.key)
end
[
*forwarded_params,
# Then here only add the params that are specific to our `create_release_backmerge_pull_request` action
# that are not directly forwarded to `create_pull_request`
FastlaneCore::ConfigItem.new(key: :source_branch,
…
And then when we call the create_pull_request
in the implementation of our action, we can inject the forwarded params by constructing a hash of fwd_params = FORWARDED_PARAMS_KEYS.to_h { |k| [k, params[k] }
then inject it in create_pull_request(title: …, body: …, **fwd_params)
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked the idea and implemented it... but then the tests started to fail mysteriously due to an additional call to git rev-parse --abbrev-ref HEAD
, and some default values also failed (i.e. nil
vs. []
) 😓 so this is something to consider when implementing this pattern. Eventually I got it working, though! Updated on 21adece.
💡 While we're fixing this action, it'd be nice if, when we push the intermediate branch on line L123/R126 ( This would especially be useful not only to note if new commits have been pushed on remote but not on local etc… but also so that the local working copy can detect when the remote branch has been deleted (i.e. the PR has been merged) when the |
7c6b226
to
079709b
Compare
Good idea 👍 Updated on 4795969. |
@iangmaia Another fix we need to do (and test, probably using some live example not just specs) is wrapping the call to the Another solution is for the caller to use |
Isn't |
Yes, which is the path in which fastlane is expecting your See this section in the doc which explains it all To my rough understanding, this is also why
Is it convoluted implementation and logic? Yes, definitievly… but that's what you get when there's lots of legacy and you don't want to break millions of codebases by changing that suddenly 😅 |
…termediate_branch_created_callback`
Ahh, TIL 😅 Thanks a lot for the details, it all makes sense now 👍 this is the kind of implementation detail I never got into before with Fastlane (or only end up seeing add-hoc when this kind of issue arises).
💯 I've just pushed daff906. |
What does it do?
Currently, the action
create_release_backmerge_pull_request
does not take anapi_url
to forward to Fastlane'screate_pull_request
action.api_url
is required when dealing with GitHub Enterprise.This PR adds the
api_url
parameter.Checklist before requesting a review
bundle exec rubocop
to test for code style violations and recommendations.specs/*_spec.rb
) if applicable.bundle exec rspec
to run the whole test suite and ensure all your tests pass.CHANGELOG.md
file to describe your changes under the appropriate existing###
subsection of the existing## Trunk
section.MIGRATION.md
file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.