ninny 0.1.16 → 0.1.20
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
- data/.github/workflows/build.yml +33 -0
- data/.github/workflows/gitleaks.toml +8 -0
- data/.github/workflows/scheduled.yml +3 -6
- data/.github/workflows/test.yml +65 -0
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/Dockerfile +3 -0
- data/README.md +0 -1
- data/lib/ninny/cli.rb +2 -0
- data/lib/ninny/commands/pull_request_merge.rb +10 -2
- data/lib/ninny/commands/stage_up.rb +1 -0
- data/lib/ninny/git.rb +1 -1
- data/lib/ninny/repository/gitlab.rb +7 -3
- data/lib/ninny/version.rb +1 -1
- data/ninny.gemspec +1 -2
- metadata +12 -23
- data/.github/workflows/main.yml +0 -34
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46272ecd2c9934f51726a97c58b5a321f5252ab4f0b813c766a7f04468fbf273
|
|
4
|
+
data.tar.gz: 8d2a26cc3476995bf96050c75adcde34f39fd8b4b30059f615ab89a626bcd83d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e71bb2b66d43902e95dd0f9531f23b60fea2c6fce06528c318cc62cb4b4380345cd01b1060575925d54f33d1523d4092f12ff8cda8c6dc974b31d10e9e8fa5f
|
|
7
|
+
data.tar.gz: 1092272a02d50caf7ede73e3dc11af63b26682b57798427ccbd5a182ffc561e3f3ceaf0bef0fb7488cb0c990b3c276ed1a3548c07aa93e7b596c2ef1cc4dfb0e
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
env:
|
|
8
|
+
REGISTRY: ghcr.io
|
|
9
|
+
IMAGE_NAME: ${{ github.repository }}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
docker-build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
packages: write
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v2
|
|
19
|
+
- uses: docker/login-action@v1.10.0
|
|
20
|
+
with:
|
|
21
|
+
registry: ${{ env.REGISTRY }}
|
|
22
|
+
username: ${{ github.actor }}
|
|
23
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
24
|
+
- uses: docker/metadata-action@v3.6.1
|
|
25
|
+
id: meta
|
|
26
|
+
with:
|
|
27
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
28
|
+
- uses: docker/build-push-action@v2.7.0
|
|
29
|
+
with:
|
|
30
|
+
context: .
|
|
31
|
+
push: true
|
|
32
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
33
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -5,7 +5,6 @@ on:
|
|
|
5
5
|
|
|
6
6
|
jobs:
|
|
7
7
|
bundler-audit:
|
|
8
|
-
if:
|
|
9
8
|
runs-on: ubuntu-latest
|
|
10
9
|
steps:
|
|
11
10
|
- uses: actions/checkout@v2
|
|
@@ -13,8 +12,7 @@ jobs:
|
|
|
13
12
|
fetch-depth: 0
|
|
14
13
|
- uses: ruby/setup-ruby@v1
|
|
15
14
|
with:
|
|
16
|
-
ruby-version:
|
|
17
|
-
bundler: 1.17.3
|
|
15
|
+
ruby-version: 3.0
|
|
18
16
|
bundler-cache: true
|
|
19
17
|
- run: |
|
|
20
18
|
gem install bundler-audit
|
|
@@ -22,7 +20,7 @@ jobs:
|
|
|
22
20
|
bundler-audit
|
|
23
21
|
|
|
24
22
|
if [ $? -eq 0 ]; then
|
|
25
|
-
echo "No vulnerabilities found."
|
|
23
|
+
echo "No gem vulnerabilities found."
|
|
26
24
|
else
|
|
27
25
|
echo "Gem vulnerabilities found!"
|
|
28
26
|
exit 1
|
|
@@ -35,8 +33,7 @@ jobs:
|
|
|
35
33
|
fetch-depth: 0
|
|
36
34
|
- uses: ruby/setup-ruby@v1
|
|
37
35
|
with:
|
|
38
|
-
ruby-version:
|
|
39
|
-
bundler: 1.17.3
|
|
36
|
+
ruby-version: 3.0
|
|
40
37
|
bundler-cache: true
|
|
41
38
|
- run: |
|
|
42
39
|
bundle outdated --strict
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
GITLEAKS_REF: f15b4e408b12fda7e2833f8a32c0d8a045bd48a0
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
ruby: [2.6, 2.7, 3.0]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
- uses: ruby/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
- run: bundle exec rake
|
|
27
|
+
pronto:
|
|
28
|
+
if: github.EVENT_NAME == 'pull_request'
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v2
|
|
32
|
+
with:
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
- uses: HeRoMo/pronto-action@v1.27.0
|
|
35
|
+
with:
|
|
36
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
37
|
+
gitleaks:
|
|
38
|
+
if: github.EVENT_NAME == 'pull_request'
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v2
|
|
42
|
+
with:
|
|
43
|
+
fetch-depth: 0
|
|
44
|
+
- run: |
|
|
45
|
+
curl -H "Accept: application/vnd.github.v3.raw" \
|
|
46
|
+
-L "https://api.github.com/repos/zricethezav/gitleaks/contents/config/gitleaks.toml?ref=${{ env.GITLEAKS_REF }}" \
|
|
47
|
+
>> ${{ github.WORKSPACE }}/.github/workflows/original.toml
|
|
48
|
+
sed "/\[allowlist\]/,/^$/d" ${{ github.WORKSPACE }}/.github/workflows/original.toml >> ${{ github.WORKSPACE }}/.github/workflows/official.toml
|
|
49
|
+
cat .github/workflows/gitleaks.toml >> .github/workflows/official.toml
|
|
50
|
+
if [[ ${{ github.REF }} == 'refs/heads/main' ]]; then
|
|
51
|
+
CURRENT_COMMIT="${{ github.SHA }}"
|
|
52
|
+
else
|
|
53
|
+
CURRENT_COMMIT="${{ github.EVENT.PULL_REQUEST.HEAD.SHA }}"
|
|
54
|
+
fi
|
|
55
|
+
echo "LOG_OPTS='^origin/main $CURRENT_COMMIT'" >> $GITHUB_ENV
|
|
56
|
+
- name: GitLeaks
|
|
57
|
+
uses: addnab/docker-run-action@v3
|
|
58
|
+
with:
|
|
59
|
+
image: zricethezav/gitleaks:v8.0.4
|
|
60
|
+
options: -v ${{ github.WORKSPACE }}:/app
|
|
61
|
+
run: |
|
|
62
|
+
cd /app
|
|
63
|
+
gitleaks detect --verbose --source='./' \
|
|
64
|
+
--config='.github/workflows/official.toml' \
|
|
65
|
+
--log-opts=${{ env.LOG_OPTS }}
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.3
|
data/Dockerfile
ADDED
data/README.md
CHANGED
data/lib/ninny/cli.rb
CHANGED
|
@@ -31,6 +31,8 @@ module Ninny
|
|
|
31
31
|
|
|
32
32
|
desc 'stage_up [PULL_REQUEST_ID]', 'Merges PR/MR into the staging branch'
|
|
33
33
|
method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
|
|
34
|
+
method_option :username, aliases: '-u', type: :string,
|
|
35
|
+
desc: "The name of the user who is staging up; defaults to the local git config's user"
|
|
34
36
|
def stage_up(pull_request_id = nil)
|
|
35
37
|
if options[:help]
|
|
36
38
|
invoke :help, ['stage_up']
|
|
@@ -6,7 +6,7 @@ module Ninny
|
|
|
6
6
|
module Commands
|
|
7
7
|
class PullRequestMerge < Ninny::Command
|
|
8
8
|
attr_accessor :pull_request_id, :options, :pull_request
|
|
9
|
-
attr_reader :branch_type
|
|
9
|
+
attr_reader :branch_type, :username
|
|
10
10
|
|
|
11
11
|
def initialize(pull_request_id, options)
|
|
12
12
|
@branch_type = options[:branch_type] || Ninny::Git::STAGING_PREFIX
|
|
@@ -65,7 +65,10 @@ module Ninny
|
|
|
65
65
|
#
|
|
66
66
|
# Returns a String
|
|
67
67
|
def comment_body
|
|
68
|
-
|
|
68
|
+
user = username || determine_local_user
|
|
69
|
+
body = "Merged into #{branch_to_merge_into}".dup
|
|
70
|
+
body << " by #{user}" if user
|
|
71
|
+
body << '.'
|
|
69
72
|
end
|
|
70
73
|
|
|
71
74
|
# Public: Find the pull request
|
|
@@ -83,6 +86,11 @@ module Ninny
|
|
|
83
86
|
def branch_to_merge_into
|
|
84
87
|
@branch_to_merge_into ||= Ninny.git.latest_branch_for(branch_type)
|
|
85
88
|
end
|
|
89
|
+
|
|
90
|
+
def determine_local_user
|
|
91
|
+
local_user_name = `git config user.name`.strip
|
|
92
|
+
local_user_name.empty? ? nil : local_user_name
|
|
93
|
+
end
|
|
86
94
|
end
|
|
87
95
|
end
|
|
88
96
|
end
|
data/lib/ninny/git.rb
CHANGED
|
@@ -95,7 +95,7 @@ module Ninny
|
|
|
95
95
|
rescue ::Git::GitExecuteError => e
|
|
96
96
|
if e.message.include?(':fatal: A branch named') && e.message.include?(' already exists')
|
|
97
97
|
puts "The local branch #{new_branch_name} already exists." \
|
|
98
|
-
|
|
98
|
+
' Please delete it manually and then run this command again.'
|
|
99
99
|
exit 1
|
|
100
100
|
end
|
|
101
101
|
end
|
|
@@ -17,8 +17,12 @@ module Ninny
|
|
|
17
17
|
to_pr(
|
|
18
18
|
gitlab.merge_requests(
|
|
19
19
|
project_id,
|
|
20
|
-
{
|
|
21
|
-
|
|
20
|
+
{
|
|
21
|
+
source_branch: Ninny.git.current_branch.name,
|
|
22
|
+
target_branch: Ninny.project_config.deploy_branch,
|
|
23
|
+
state: 'opened'
|
|
24
|
+
}
|
|
25
|
+
).auto_paginate.last
|
|
22
26
|
)
|
|
23
27
|
end
|
|
24
28
|
|
|
@@ -27,7 +31,7 @@ module Ninny
|
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def open_pull_requests
|
|
30
|
-
gitlab.merge_requests(project_id, { state: 'opened' }).map { |mr| to_pr(mr) }
|
|
34
|
+
gitlab.merge_requests(project_id, { state: 'opened' }).auto_paginate.map { |mr| to_pr(mr) }
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
def pull_request(id)
|
data/lib/ninny/version.rb
CHANGED
data/ninny.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
26
|
spec.require_paths = ['lib']
|
|
27
27
|
|
|
28
|
-
spec.add_dependency 'git', '~> 1.5
|
|
28
|
+
spec.add_dependency 'git', '~> 1.5'
|
|
29
29
|
spec.add_dependency 'gitlab', '~> 4.11'
|
|
30
30
|
spec.add_dependency 'pastel', '~> 0.8'
|
|
31
31
|
spec.add_dependency 'thor', '< 2'
|
|
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.add_dependency 'tty-config', '~> 0.3'
|
|
36
36
|
spec.add_dependency 'tty-prompt', '~> 0.23'
|
|
37
37
|
|
|
38
|
-
spec.add_development_dependency 'bundler', '~> 1.17'
|
|
39
38
|
spec.add_development_dependency 'byebug', '~> 11.1'
|
|
40
39
|
spec.add_development_dependency 'guard-rspec', '~> 4.3'
|
|
41
40
|
spec.add_development_dependency 'pronto', '~> 0.11'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ninny
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.20
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dispatch Engineers
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: git
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.5
|
|
19
|
+
version: '1.5'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.5
|
|
26
|
+
version: '1.5'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: gitlab
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,20 +136,6 @@ dependencies:
|
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0.23'
|
|
139
|
-
- !ruby/object:Gem::Dependency
|
|
140
|
-
name: bundler
|
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
|
142
|
-
requirements:
|
|
143
|
-
- - "~>"
|
|
144
|
-
- !ruby/object:Gem::Version
|
|
145
|
-
version: '1.17'
|
|
146
|
-
type: :development
|
|
147
|
-
prerelease: false
|
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
-
requirements:
|
|
150
|
-
- - "~>"
|
|
151
|
-
- !ruby/object:Gem::Version
|
|
152
|
-
version: '1.17'
|
|
153
139
|
- !ruby/object:Gem::Dependency
|
|
154
140
|
name: byebug
|
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -285,13 +271,16 @@ extensions: []
|
|
|
285
271
|
extra_rdoc_files: []
|
|
286
272
|
files:
|
|
287
273
|
- ".github/pull_request_template.md"
|
|
288
|
-
- ".github/workflows/
|
|
274
|
+
- ".github/workflows/build.yml"
|
|
275
|
+
- ".github/workflows/gitleaks.toml"
|
|
289
276
|
- ".github/workflows/scheduled.yml"
|
|
277
|
+
- ".github/workflows/test.yml"
|
|
290
278
|
- ".gitignore"
|
|
291
279
|
- ".rspec"
|
|
292
280
|
- ".rubocop.yml"
|
|
293
281
|
- ".ruby-gemset"
|
|
294
282
|
- ".ruby-version"
|
|
283
|
+
- Dockerfile
|
|
295
284
|
- Gemfile
|
|
296
285
|
- Guardfile
|
|
297
286
|
- LICENSE.txt
|
|
@@ -325,7 +314,7 @@ homepage: https://github.com/dispatchinc/ninny
|
|
|
325
314
|
licenses:
|
|
326
315
|
- MIT
|
|
327
316
|
metadata: {}
|
|
328
|
-
post_install_message:
|
|
317
|
+
post_install_message:
|
|
329
318
|
rdoc_options: []
|
|
330
319
|
require_paths:
|
|
331
320
|
- lib
|
|
@@ -340,8 +329,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
340
329
|
- !ruby/object:Gem::Version
|
|
341
330
|
version: '0'
|
|
342
331
|
requirements: []
|
|
343
|
-
rubygems_version: 3.
|
|
344
|
-
signing_key:
|
|
332
|
+
rubygems_version: 3.2.32
|
|
333
|
+
signing_key:
|
|
345
334
|
specification_version: 4
|
|
346
335
|
summary: 'ninny (n): an foolish person, see: git'
|
|
347
336
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
name: Main
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [ main ]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [ main ]
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
test:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
strategy:
|
|
12
|
-
fail-fast: false
|
|
13
|
-
matrix:
|
|
14
|
-
ruby: [2.6.3, 2.6.6, 2.7.0, 2.7.2, 3.0.0]
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
with:
|
|
18
|
-
fetch-depth: 0
|
|
19
|
-
- uses: ruby/setup-ruby@v1
|
|
20
|
-
with:
|
|
21
|
-
ruby-version: ${{ matrix.ruby }}
|
|
22
|
-
bundler: 1.17.3
|
|
23
|
-
bundler-cache: true
|
|
24
|
-
- run: bundle exec rake
|
|
25
|
-
pronto:
|
|
26
|
-
if: github.EVENT_NAME == 'pull_request'
|
|
27
|
-
runs-on: ubuntu-latest
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@v2
|
|
30
|
-
with:
|
|
31
|
-
fetch-depth: 0
|
|
32
|
-
- uses: HeRoMo/pronto-action@v1.13.0
|
|
33
|
-
with:
|
|
34
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|