git-lint 1.2.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.adoc +70 -35
- data/lib/git/lint.rb +1 -3
- data/lib/git/lint/analyzers/abstract.rb +3 -3
- data/lib/git/lint/analyzers/commit_author_name.rb +1 -1
- data/lib/git/lint/analyzers/commit_body_leading_line.rb +3 -3
- data/lib/git/lint/analyzers/commit_subject_prefix.rb +1 -1
- data/lib/git/lint/analyzers/commit_trailer_collaborator_capitalization.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_duplication.rb +3 -3
- data/lib/git/lint/analyzers/commit_trailer_collaborator_email.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_key.rb +2 -2
- data/lib/git/lint/analyzers/commit_trailer_collaborator_name.rb +2 -2
- data/lib/git/lint/branches/environments/circle_ci.rb +6 -6
- data/lib/git/lint/branches/environments/git_hub_action.rb +6 -6
- data/lib/git/lint/branches/environments/local.rb +6 -6
- data/lib/git/lint/branches/environments/netlify_ci.rb +8 -8
- data/lib/git/lint/branches/environments/travis_ci.rb +10 -10
- data/lib/git/lint/branches/feature.rb +6 -7
- data/lib/git/lint/cli.rb +9 -11
- data/lib/git/lint/collector.rb +2 -2
- data/lib/git/lint/identity.rb +1 -1
- data/lib/git/lint/parsers/trailers/collaborator.rb +2 -2
- data/lib/git/lint/reporters/branch.rb +14 -14
- data/lib/git/lint/runner.rb +5 -4
- data/lib/git/lint/validators/capitalization.rb +1 -1
- data/lib/git/lint/validators/name.rb +1 -1
- metadata +30 -215
- metadata.gz.sig +0 -0
- data/lib/git/kit/repo.rb +0 -30
- data/lib/git/lint/commits/saved.rb +0 -104
- data/lib/git/lint/commits/unsaved.rb +0 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0ccd4d14bc5a75b14ae5a825f5eec453a560bc3e6df2bc959bbcb90f626794
|
4
|
+
data.tar.gz: 5f64925793493c9cde59a4828666137ba6a5203f664d5b97ce994552b38fcb42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b295196574a134f2ae5a3989c71d7023998eaf96476055a8c511a3f5d684fbaf1d9456fe887389042d4f8a88fb0d7bce0ea8e1a5663c490c1cf7756b9d6384c8
|
7
|
+
data.tar.gz: 542818d4e2dced990b4231b53160e6c59272c1db908e309a10566210be26eeddb6213ec1f6581c75b078f6d8581e0b4f85827efe03d0f93ce9a216a8133c94a8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -8,31 +8,29 @@
|
|
8
8
|
|
9
9
|
[link=http://badge.fury.io/rb/git-lint]
|
10
10
|
image::https://badge.fury.io/rb/git-lint.svg[Gem Version]
|
11
|
+
[link=https://www.alchemists.io/projects/code_quality]
|
12
|
+
image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
|
11
13
|
[link=https://circleci.com/gh/bkuhlmann/git-lint]
|
12
14
|
image::https://circleci.com/gh/bkuhlmann/git-lint.svg?style=svg[Circle CI Status]
|
13
15
|
|
14
16
|
[link=https://travis-ci.org/bkuhlmann/git-lint]
|
15
|
-
image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=
|
17
|
+
image::https://travis-ci.org/bkuhlmann/git-lint.svg?branch=main[Travis CI Status]
|
16
18
|
[link=https://app.netlify.com/sites/git-lint/deploys]
|
17
19
|
image::https://api.netlify.com/api/v1/badges/7e23b422-3412-4e7f-b654-65c0417a0b1f/deploy-status[Netlify CI Status]
|
18
20
|
|
19
21
|
A command line interface for linting Git commits. Ensures you maintain a clean, easy to read,
|
20
22
|
debuggable, and maintainable project history.
|
21
23
|
|
22
|
-
*Git Lint is the official port of the original Git Cop project that avoids references to violence or
|
23
|
-
violent terminology that might make anyone feel unwelcome. The name change was necessary in order to
|
24
|
-
better support the link:https://blacklivesmatter.com[Black Lives Matter] and
|
25
|
-
link:https://8cantwait.org[Defund Police] movements.*
|
26
|
-
|
27
24
|
toc::[]
|
28
25
|
|
29
26
|
== Features
|
30
27
|
|
31
28
|
* Enforces a {git_rebase_workflow_link}.
|
32
29
|
* Enforces a clean and consistent Git commit history.
|
30
|
+
* Supports Git default branch configuration.
|
33
31
|
* Provides a customizable suite of analyzers.
|
34
32
|
* Provides Git Hook support for local use.
|
35
|
-
* Provides Continuous Integration (CI)
|
33
|
+
* Provides Continuous Integration (CI) support.
|
36
34
|
|
37
35
|
== Screencasts
|
38
36
|
|
@@ -69,9 +67,9 @@ git-lint -v, [--version] # Show gem version.
|
|
69
67
|
To check if your Git commit history is clean, run: `git-lint --analyze`. It will exit with a failure
|
70
68
|
if at least one issue with error severity is detected.
|
71
69
|
|
72
|
-
This gem does not check commits on `
|
73
|
-
to rewrite or fix commits on `
|
74
|
-
detects all commits made since
|
70
|
+
This gem does not check commits on your default branch (i.e. `main`). This is intentional as you
|
71
|
+
would, generally, not want to rewrite or fix commits on the `main` branch. This gem is best used on
|
72
|
+
feature branches as it automatically detects all commits made since creation of the feature branch.
|
75
73
|
|
76
74
|
Here is an example workflow, using gem defaults with issues detected:
|
77
75
|
|
@@ -113,6 +111,21 @@ Now, when running `bundle exec rake -T`, you'll see `git_lint` included in the l
|
|
113
111
|
|
114
112
|
If you need a concrete example, check out the link:Rakefile[Rakefile] of this project for details.
|
115
113
|
|
114
|
+
=== Default Branch
|
115
|
+
|
116
|
+
Your default branch configuration is respected no matter if it is set globally or locally. If the
|
117
|
+
default branch is _not set_ then Git Lint will fall back to `master` for backwards compatibility.
|
118
|
+
When the next major version is released, the default branch fallback will change from `master` to
|
119
|
+
`main`. You can set your default branch at any time by running the following from the command line:
|
120
|
+
|
121
|
+
[source,bash]
|
122
|
+
----
|
123
|
+
git config --add init.defaultBranch main
|
124
|
+
----
|
125
|
+
|
126
|
+
💡 When setting your default branch, ensure you use a consistent Git configuration across all of
|
127
|
+
your environments.
|
128
|
+
|
116
129
|
=== Configuration
|
117
130
|
|
118
131
|
This gem can be configured via a global configuration:
|
@@ -291,7 +304,7 @@ maintenance costs for you. To configure global Git Hooks, add the following to y
|
|
291
304
|
....
|
292
305
|
|
293
306
|
Then you can customize Git Hooks for all of your projects.
|
294
|
-
link:https://github.com/bkuhlmann/dotfiles/tree/
|
307
|
+
link:https://github.com/bkuhlmann/dotfiles/tree/main/home_files/.config/git/hooks[Check out these
|
295
308
|
examples].
|
296
309
|
|
297
310
|
If a global configuration is not desired, you can add Git Hooks at a per project level by editing
|
@@ -376,7 +389,7 @@ have a build server that is not listed, please log an issue or provide an implem
|
|
376
389
|
support.
|
377
390
|
|
378
391
|
Calculation of commits is done by reviewing all commits made on the feature branch since branching
|
379
|
-
from `
|
392
|
+
from `main`.
|
380
393
|
|
381
394
|
==== link:https://circleci.com[Circle CI]
|
382
395
|
|
@@ -868,7 +881,7 @@ worth considering:
|
|
868
881
|
blindly combine multiple commit messages without editing them into a single, coherent message._
|
869
882
|
* Use `git rebase --interactive` when cleaning up commit history, order, messages, etc. This should
|
870
883
|
be done prior to submitting a code review or when code review feedback has been addressed and
|
871
|
-
you are ready to rebase onto `
|
884
|
+
you are ready to rebase onto `main`.
|
872
885
|
* Use `git push --force-with-lease` instead of `git push --force` when pushing changes after an
|
873
886
|
interactive rebasing session.
|
874
887
|
* Avoid checking in development-specific configuration files (add to `.gitignore` instead).
|
@@ -913,19 +926,24 @@ configuration disabled.
|
|
913
926
|
* Use small, atomic commits:
|
914
927
|
** Easier to review and provide feedback.
|
915
928
|
** Easier to review implementation and corresponding tests.
|
916
|
-
** Easier to document with detailed
|
917
|
-
request).
|
929
|
+
** Easier to document with detailed subjects (especially when grouped together in a pull request).
|
918
930
|
** Easier to reword, edit, squash, fix, or drop when interactively rebasing.
|
919
931
|
** Easier to combine together versus tearing apart a larger commit into smaller commits.
|
920
932
|
* Use logically ordered commits:
|
921
933
|
** Each commit should tell a story and be a logical building block to the next commit.
|
934
|
+
** Each commit should, ideally, be the implementation plus corresponding test. Avoid committing
|
935
|
+
changes that are a jumble of mixed ideas as they are hard to decipher and a huge insult not only
|
936
|
+
to the reviewer but your future self.
|
922
937
|
** Each commit, when reviewed in order, should be able to explain _how_ the feature or bug fix was
|
923
938
|
completed and implemented properly.
|
939
|
+
* Keep refactored code separate from behavioral changes. This makes the review process easier
|
940
|
+
because you don't have to sift through all the line and format changes to figure out what is new
|
941
|
+
or changed.
|
924
942
|
|
925
943
|
=== Branches
|
926
944
|
|
927
945
|
* Use feature branches for new work.
|
928
|
-
* Maintain branches by rebasing upon `
|
946
|
+
* Maintain branches by rebasing upon `main` on a regular basis.
|
929
947
|
|
930
948
|
=== Tags
|
931
949
|
|
@@ -947,15 +965,18 @@ configuration disabled.
|
|
947
965
|
* Use hooks globally rather than locally per project. Doing this applies the same functionality
|
948
966
|
across all projects automatically, reduces maintenance per project, and provides consistency
|
949
967
|
across all projects. This can best be managed via your
|
950
|
-
link:https://github.com/bkuhlmann/dotfiles/tree/
|
968
|
+
link:https://github.com/bkuhlmann/dotfiles/tree/main/home_files/.config/git/hooks[Dotfiles].
|
951
969
|
* Avoid forcing global or local project hooks as a team-wide mandate. Hooks are a personal tool much
|
952
970
|
like editors or other tools one choose to do their work. For team consistency, use a continuous
|
953
971
|
integration build server instead.
|
954
972
|
|
955
973
|
=== Code Reviews
|
956
974
|
|
957
|
-
There are
|
975
|
+
There are three main objectives each code review should achieve:
|
958
976
|
|
977
|
+
. *Joy* - The experience of working with you, receiving feedback, giving feedback, and demonstrating
|
978
|
+
a level of care influences others and encourages a collaborative environment that is fun to work
|
979
|
+
in. Use this time to build and reinforce trust amongst your fellow colleagues.
|
959
980
|
. *Quality*: Ensures changes are of highest quality that adhere to team standards while enhancing
|
960
981
|
the customer experience and not disrupting their workflow.
|
961
982
|
. *Education*: Provides a chance for everyone on the team to learn more about the architecture,
|
@@ -965,13 +986,22 @@ There are two objectives each code review should achieve:
|
|
965
986
|
In addition to the objectives above, the following guidelines are worth following:
|
966
987
|
|
967
988
|
* Keep code reviews short and easy to review:
|
989
|
+
** Review your own code first before submitting to others. By ensuring your are confident in the
|
990
|
+
overall implementation and the commits in terms of commit messages and implementation details,
|
991
|
+
you'll encourage higher quality feedback and show appreciation for the reviewer's time.
|
968
992
|
** Provide a high level overview that answers _why_ the code review is necessary.
|
969
|
-
** Provide a link to the issue
|
993
|
+
** Provide a link to the issue that prompted the code review (if any) and any additional details
|
994
|
+
worth highlighting to guide the reviewer through the process.
|
970
995
|
** Provide screenshots/screencasts if possible.
|
971
|
-
**
|
972
|
-
**
|
973
|
-
|
974
|
-
|
996
|
+
** Provide any ancillary notes or points of interest worth highlighting for the reviewer.
|
997
|
+
** Ensure commits within the code review are related to the purpose of the code review and avoid
|
998
|
+
mixing in changes that are ancillary to the primary objective of the code view. If you do have
|
999
|
+
changes outside of the scope of the current code review, open those changes up as a separate code
|
1000
|
+
review instead.
|
1001
|
+
** Prefer code reviews at about 300 lines in order to keep the quality of the code review and defect
|
1002
|
+
detection high. This also shows you value the reviewers time and attention away from their own
|
1003
|
+
work.
|
1004
|
+
** Avoid working on a large issues without first getting feedback in order to not overwhelm/surprise
|
975
1005
|
the maintainers. More discussion up front will help ensure your work has a faster chance of
|
976
1006
|
acceptance.
|
977
1007
|
* Review and rebase code reviews quickly:
|
@@ -1002,25 +1032,30 @@ In addition to the objectives above, the following guidelines are worth followin
|
|
1002
1032
|
implementation. This is _blocking_ and requires immediate correction. The reviewer should
|
1003
1033
|
provide a suggested solution and/or links to patterns, articles, etc. that might help the author
|
1004
1034
|
fix the implementation. Pairing is encouraged if feedback is vast and/or complex.
|
1005
|
-
**
|
1006
|
-
_blocking_ feedback and must be addressed immediately.
|
1035
|
+
** 🔓 (`:unlock:`) - Signifies a security violation that would damage us and/or our customers. This
|
1036
|
+
is _blocking_ feedback and must be addressed immediately.
|
1007
1037
|
** 💡 (`:bulb:`) - Indicates a helpful tip or trick for improving the code. This can be
|
1008
1038
|
_blocking_ or _non-blocking_ feedback and is left up to the author to decide. Generally, it is a
|
1009
1039
|
good idea to address and resolve the feedback.
|
1010
1040
|
** 🙇 (`:bow:`) - Indicates thankfulness of the feedback received. This is _non-blocking_ and
|
1011
1041
|
always meant as a response to helpful feedback.
|
1012
1042
|
** ✅ (`:white_check_mark:`) - Signifies code review approval. The author can
|
1013
|
-
rebase onto `
|
1043
|
+
rebase onto `main` and delete the feature branch at this point.
|
1044
|
+
* Use all feedback as a chance to learn, teach, strenghen the bond of trust between you and your
|
1045
|
+
fellow colleagues, and avoid being cut by
|
1046
|
+
link:https://fs.blog/2017/04/mental-model-hanlons-razor[Hanlon's Razor].
|
1047
|
+
* Use automation to ensure code reviews are consistent, of high quality, and swift to resolve. Each
|
1048
|
+
code review can be an opportunity to identify and automate the process further.
|
1014
1049
|
* Use face-to-face communication if a code review's written discussion gets lengthy/noisy.
|
1015
|
-
* Create
|
1016
|
-
delaying code review acceptance. Return to the code review once
|
1017
|
-
* The author, not the reviewer, should rebase the feature branch onto `
|
1018
|
-
* Avoid reviewing your own code review before rebasing onto `
|
1050
|
+
* Create follow-up actions if additional features are discovered during a code review to avoid
|
1051
|
+
delaying code review acceptance. Return to the code review once the new actions have been logged.
|
1052
|
+
* The author, not the reviewer, should rebase the feature branch onto `main` upon approval.
|
1053
|
+
* Avoid reviewing your own code review before rebasing onto `main`. Have another pair of eyes
|
1019
1054
|
review your code first.
|
1020
|
-
* Ensure the following criteria is met before rebasing your feature branch to `
|
1055
|
+
* Ensure the following criteria is met before rebasing your feature branch to `main`:
|
1021
1056
|
** Ensure all `fixup!` and `squash!` commits are interactively rebased. _Avoid rebasing these onto
|
1022
|
-
the `
|
1023
|
-
** Ensure your feature branch is rebased upon `
|
1057
|
+
the `main` branch!_
|
1058
|
+
** Ensure your feature branch is rebased upon `main`.
|
1024
1059
|
** Ensure all tests and code quality checks are passing.
|
1025
1060
|
** Ensure the feature branch is deleted after being successfully rebased.
|
1026
1061
|
|
@@ -1032,12 +1067,12 @@ and editing your merge options for code reviews as follows:
|
|
1032
1067
|
|
1033
1068
|
image::https://www.alchemists.io/images/projects/git-lint/screenshots/github-settings-options.png[GitHub Merge Options]
|
1034
1069
|
|
1035
|
-
In addition to the above, you'll want to add _branch_ protection rules for your `
|
1070
|
+
In addition to the above, you'll want to add _branch_ protection rules for your `main` branch. To
|
1036
1071
|
do this, follow these steps:
|
1037
1072
|
|
1038
1073
|
. Visit your branch settings (i.e. `https://github.com/<username>/<project>/settings/branches`).
|
1039
1074
|
. Click the _Add rule_ button.
|
1040
|
-
. For _branch name pattern_, enter: `
|
1075
|
+
. For _branch name pattern_, enter: `main`.
|
1041
1076
|
. Check _Require pull request reviews before merging_.
|
1042
1077
|
. Set _Required approving reviews_ to `2` as a minimum.
|
1043
1078
|
. Check _Dismiss stale pull request approvals when new commits are pushed_.
|
data/lib/git/lint.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "git_plus"
|
3
4
|
require "git/lint/identity"
|
4
|
-
require "git/kit/repo"
|
5
5
|
require "git/lint/refinements/strings"
|
6
6
|
require "git/lint/errors/base"
|
7
7
|
require "git/lint/errors/severity"
|
@@ -11,8 +11,6 @@ require "git/lint/validators/email"
|
|
11
11
|
require "git/lint/validators/name"
|
12
12
|
require "git/lint/validators/capitalization"
|
13
13
|
require "git/lint/parsers/trailers/collaborator"
|
14
|
-
require "git/lint/commits/saved"
|
15
|
-
require "git/lint/commits/unsaved"
|
16
14
|
require "git/lint/branches/environments/local"
|
17
15
|
require "git/lint/branches/environments/circle_ci"
|
18
16
|
require "git/lint/branches/environments/git_hub_action"
|
@@ -91,10 +91,10 @@ module Git
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
commit.
|
94
|
+
def affected_commit_trailers
|
95
|
+
commit.trailers
|
96
96
|
.each.with_object([])
|
97
|
-
.with_index(commit.
|
97
|
+
.with_index(commit.trailers_index) do |(line, lines), index|
|
98
98
|
yield if block_given?
|
99
99
|
lines << self.class.build_issue_line(index, line) if invalid_line? line
|
100
100
|
end
|
@@ -12,12 +12,12 @@ module Git
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def valid?
|
15
|
-
|
16
|
-
subject, body =
|
15
|
+
message = commit.message
|
16
|
+
subject, body = message.split "\n", 2
|
17
17
|
|
18
18
|
return true if !String(subject).empty? && String(body).strip.empty?
|
19
19
|
|
20
|
-
|
20
|
+
message.match?(/\A.+(\n\n|\#).+/m)
|
21
21
|
end
|
22
22
|
|
23
23
|
def issue
|
@@ -23,7 +23,7 @@ module Git
|
|
23
23
|
# rubocop:enable Metrics/ParameterLists
|
24
24
|
|
25
25
|
def valid?
|
26
|
-
|
26
|
+
affected_commit_trailers.empty?
|
27
27
|
end
|
28
28
|
|
29
29
|
def issue
|
@@ -31,7 +31,7 @@ module Git
|
|
31
31
|
|
32
32
|
{
|
33
33
|
hint: "Name must be capitalized.",
|
34
|
-
lines:
|
34
|
+
lines: affected_commit_trailers
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -20,7 +20,7 @@ module Git
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid?
|
23
|
-
|
23
|
+
affected_commit_trailers.empty?
|
24
24
|
end
|
25
25
|
|
26
26
|
def issue
|
@@ -28,7 +28,7 @@ module Git
|
|
28
28
|
|
29
29
|
{
|
30
30
|
hint: "Avoid duplication.",
|
31
|
-
lines:
|
31
|
+
lines: affected_commit_trailers
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -47,7 +47,7 @@ module Git
|
|
47
47
|
zeros = Hash.new { |new_hash, missing_key| new_hash[missing_key] = 0 }
|
48
48
|
|
49
49
|
zeros.tap do |collection|
|
50
|
-
commit.
|
50
|
+
commit.trailers.each { |line| collection[line] += 1 if parser.new(line).match? }
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -24,7 +24,7 @@ module Git
|
|
24
24
|
# rubocop:enable Metrics/ParameterLists
|
25
25
|
|
26
26
|
def valid?
|
27
|
-
|
27
|
+
affected_commit_trailers.empty?
|
28
28
|
end
|
29
29
|
|
30
30
|
def issue
|
@@ -32,7 +32,7 @@ module Git
|
|
32
32
|
|
33
33
|
{
|
34
34
|
hint: %(Email must follow name and use format: "<name@server.domain>".),
|
35
|
-
lines:
|
35
|
+
lines: affected_commit_trailers
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
@@ -20,7 +20,7 @@ module Git
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def valid?
|
23
|
-
|
23
|
+
affected_commit_trailers.empty?
|
24
24
|
end
|
25
25
|
|
26
26
|
def issue
|
@@ -28,7 +28,7 @@ module Git
|
|
28
28
|
|
29
29
|
{
|
30
30
|
hint: "Use format: #{filter_list.to_hint}.",
|
31
|
-
lines:
|
31
|
+
lines: affected_commit_trailers
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
@@ -25,7 +25,7 @@ module Git
|
|
25
25
|
# rubocop:enable Metrics/ParameterLists
|
26
26
|
|
27
27
|
def valid?
|
28
|
-
|
28
|
+
affected_commit_trailers.empty?
|
29
29
|
end
|
30
30
|
|
31
31
|
def issue
|
@@ -33,7 +33,7 @@ module Git
|
|
33
33
|
|
34
34
|
{
|
35
35
|
hint: "Name must follow key and consist of #{minimum} parts (minimum).",
|
36
|
-
lines:
|
36
|
+
lines: affected_commit_trailers
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -6,21 +6,21 @@ module Git
|
|
6
6
|
module Environments
|
7
7
|
# Provides Circle CI build environment feature branch information.
|
8
8
|
class CircleCI
|
9
|
-
def initialize
|
10
|
-
@
|
9
|
+
def initialize repository: GitPlus::Repository.new
|
10
|
+
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
13
|
def name
|
14
|
-
"origin/#{
|
14
|
+
"origin/#{repository.branch_name}"
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def commits
|
18
|
+
repository.commits "origin/#{repository.branch_default}..#{name}"
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
attr_reader :
|
23
|
+
attr_reader :repository
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -6,21 +6,21 @@ module Git
|
|
6
6
|
module Environments
|
7
7
|
# Provides GitHub Action build environment feature branch information.
|
8
8
|
class GitHubAction
|
9
|
-
def initialize
|
10
|
-
@
|
9
|
+
def initialize repository: GitPlus::Repository.new
|
10
|
+
@repository = repository
|
11
11
|
end
|
12
12
|
|
13
13
|
def name
|
14
|
-
"origin/#{
|
14
|
+
"origin/#{repository.branch_name}"
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
17
|
+
def commits
|
18
|
+
repository.commits "origin/#{repository.branch_default}..#{name}"
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
attr_reader :
|
23
|
+
attr_reader :repository
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|