-
-
Notifications
You must be signed in to change notification settings - Fork 54
Rework PR/MR feature #219
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
Merged
bastelfreak
merged 21 commits into
voxpupuli:master
from
opus-codium:rework-prmr-feature
Oct 8, 2021
Merged
Rework PR/MR feature #219
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1b4cd4c
Tests: Move PR/MR related features to a dedicated file
bittner 7aa59da
Tests: Add a PR/MR scenario when no credentials are given
neomilium 1eb4c21
Tests: Add a PR/MR scenario with modules from GitHub and GitLab
neomilium af833b3
Refactor PR/MR related code (1/2)
neomilium ed8e4d2
Refactor PR/MR related code (2/2)
neomilium 1173a47
Spec: Use multiline notation in GitHub specs
neomilium 29f5841
Spec: Use rspec context in GitHub and GitLab specs
neomilium 3fecd3e
Tests: Add PR scenarios with same target and source branches
neomilium 61990db
Rework PR/MR related code (1/2)
neomilium 51cb45a
CLI: Fix PR default target branch
neomilium d035941
PR/MR: Output PR/MR intent only when relevent in noop
neomilium b57f9e2
Tests: Fix PR/MR feature tests
neomilium 44b6260
Rework PR/MR related code (2/2)
neomilium 3fbe1b5
Rubocop: Update autogenerated todo file
neomilium a476c95
Spec: Add a minimal spec file for SourceCode
neomilium ce795d5
GitService: Improve hostname extraction
neomilium bb02241
GitService: Raises error about missing credentials only on instantiation
neomilium ba59519
GitService: Move factory part into dedicated module
neomilium 57a715a
Tests: Use example.com according to RFC2606
neomilium a3bf16f
GitService: Define a protected #_open_pull_request method
neomilium 57ebbb4
GitServices: Clean up requirements
neomilium File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| module ModuleSync | ||
| # Namespace for Git service classes (ie. GitHub, GitLab) | ||
| module GitService | ||
| def self.instantiate(type:, options:) | ||
| options ||= {} | ||
| case type | ||
| when :github | ||
| endpoint = options[:base_url] || ENV.fetch('GITHUB_BASE_URL', 'https://api.github.com') | ||
| token = options[:token] || ENV['GITHUB_TOKEN'] | ||
| raise ModuleSync::Error, 'No GitHub token specified to create a pull request' if token.nil? | ||
| require 'modulesync/pr/github' | ||
| return ModuleSync::PR::GitHub.new(token, endpoint) | ||
| when :gitlab | ||
| endpoint = options[:base_url] || ENV.fetch('GITLAB_BASE_URL', 'https://gitlab.com/api/v4') | ||
| token = options[:token] || ENV['GITLAB_TOKEN'] | ||
| raise ModuleSync::Error, 'No GitLab token specified to create a merge request' if token.nil? | ||
| require 'modulesync/pr/gitlab' | ||
| return ModuleSync::PR::GitLab.new(token, endpoint) | ||
| else | ||
| raise ModuleSync::Error, "Unable to manage a PR/MR for Git service: '#{type}'" | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| require 'modulesync/git_service' | ||
|
|
||
| describe ModuleSync::GitService do | ||
| context 'when instantiate a GitHub service without credentials' do | ||
| it 'raises an error' do | ||
| expect { ModuleSync::GitService.instantiate(type: :github, options: nil) }.to raise_error(ModuleSync::Error, 'No GitHub token specified to create a pull request') | ||
| end | ||
| end | ||
|
|
||
| context 'when instantiate a GitLab service without credentials' do | ||
| it 'raises an error' do | ||
| expect { ModuleSync::GitService.instantiate(type: :gitlab, options: nil) }.to raise_error(ModuleSync::Error, 'No GitLab token specified to create a merge request') | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.