octoauth 1.9.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a8089ceca805bb42c2890b1f1734ff64a9907a2de20a0d99998622db2627ffe
4
- data.tar.gz: e9dba99a1f8a2ebbac46e4ad75c696c45080025a1170f3b2178738e4ae419bdb
3
+ metadata.gz: 29b43a20cb61538f2714aebf421f9174aaeec8f443a9535c7e0c14af297c8aa4
4
+ data.tar.gz: 905f1d586b200888c014aab201b91f139e3c9bc41b1de69a8a31d84eeea6c539
5
5
  SHA512:
6
- metadata.gz: 47bca4b50a2a3f6953b9a42c6d4109bc7c7ff85e1d7738a71514a15c62f8cdb8041d91309c77edb8dea289e1c569700d520d396bf9de88452fead635a849a939
7
- data.tar.gz: 608a0a63f897e36ca4b8fdd1ca30ba4a6e7aabd44a207ea3f30db970b195a31d68a168b0c7ae42ee5db34707a6cc82674ebe0f99ad6cd1dc8a4486c34206a5e2
6
+ metadata.gz: febcbe8962325e1c12a9a236bbecb959deb0ddb255f2464bf5d178d7056564e124333db9ddd6def09926e8c9c95afaa9a303b0c25f59695b0bb0959186c36e35
7
+ data.tar.gz: ce14815044feeff65c30949366186ce53bbab05dd508dd9109f49f374fb627303835cc3a21933e0b04406788c33b4f697830e61ea158caf476a4b70244f482c2
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ URL="https://exporter.akerl.app/metric"
6
+ AUTH="Authorization: Bearer $EXPORTER_TOKEN"
7
+ if [[ "$JOB_STATUS" == "success" ]] ; then
8
+ VALUE=1
9
+ else
10
+ VALUE=0
11
+ fi
12
+ BODY="{\"name\":\"gh/${GITHUB_REPOSITORY}\",\"metrics\":[{\"name\":\"ghactions\",\"type\":\"gauge\",\"tags\":{\"repo\":\"${GITHUB_REPOSITORY}\"},\"value\":\"${VALUE}\"}]}"
13
+
14
+ echo "$BODY"
15
+
16
+ curl -i -XPOST -d "$BODY" -H"$AUTH" "$URL"
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Build
3
+ 'on':
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - "**"
9
+ pull_request_target:
10
+ jobs:
11
+ build:
12
+ name: Build
13
+ runs-on: ubuntu-22.04
14
+ permissions:
15
+ contents: write
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v3
19
+ with:
20
+ submodules: recursive
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '3.1'
24
+ bundler-cache: true
25
+ - name: Build
26
+ run: bundle exec rake
27
+ - name: Release
28
+ if: github.ref_type == 'tag'
29
+ run: bundle exec rake release
30
+ env:
31
+ GEM_HOST_API_KEY: "${{ secrets.GEM_HOST_API_KEY }}"
32
+ - name: Post to hook-exporter
33
+ run: "./.github/exporter.sh"
34
+ env:
35
+ EXPORTER_TOKEN: "${{ secrets.EXPORTER_TOKEN }}"
36
+ JOB_STATUS: "${{ job.status }}"
37
+ if: always() && github.ref == 'refs/heads/main'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 2.0.0 / 2022-10-21
2
+
3
+ * [ENHANCEMENT] Update octokit to ~> 5.6.1. Note that GitHub has deprecated the password-based API for getting access tokens, so Octokit will no longer function.
4
+
1
5
  # 1.9.0 / 2022-03-23
2
6
 
3
7
  * [ENHANCEMENT] Update octokit to ~> 4.22.0
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Les Aker
3
+ Copyright (c) 2022 Les Aker
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,9 +2,7 @@ octoauth
2
2
  =========
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/octoauth.svg)](https://rubygems.org/gems/octoauth)
5
- [![Build Status](https://img.shields.io/travis/com/akerl/octoauth.svg)](https://travis-ci.com/akerl/octoauth)
6
- [![Coverage Status](https://img.shields.io/codecov/c/github/akerl/octoauth.svg)](https://codecov.io/github/akerl/octoauth)
7
- [![Code Quality](https://img.shields.io/codacy/648fd8ebe3374dd4acc5449b8922f2e0.svg)](https://www.codacy.com/app/akerl/octoauth)
5
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/akerl/octoauth/build.yml?branch=main)](https://github.com/akerl/octoauth/actions)
8
6
  [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
9
7
 
10
8
  Authentication wrapper for GitHub's API
data/octoauth.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'octoauth'
3
- s.version = '1.9.0'
3
+ s.version = '2.0.1'
4
4
 
5
- s.required_ruby_version = '>= 2.5.0'
5
+ s.required_ruby_version = '>= 2.6'
6
6
 
7
7
  s.summary = 'Auth token helper for GitHub API'
8
8
  s.description = 'Lightweight wrapper to sanely handle OAuth tokens with Octokit'
@@ -12,14 +12,13 @@ Gem::Specification.new do |s|
12
12
  s.license = 'MIT'
13
13
 
14
14
  s.files = `git ls-files`.split
15
- s.test_files = `git ls-files spec/*`.split
16
15
 
17
- s.add_dependency 'octokit', '~> 4.22.0'
16
+ s.add_dependency 'octokit', '~> 10.0.0'
18
17
  s.add_dependency 'userinput', '~> 1.0.2'
19
18
 
20
- s.add_development_dependency 'goodcop', '~> 0.9.5'
21
- s.add_development_dependency 'vcr', '~> 5.0.0'
22
- s.add_development_dependency 'webmock', '~> 3.7.6'
19
+ s.add_development_dependency 'goodcop', '~> 0.9.7'
20
+ s.add_development_dependency 'vcr', '~> 6.3.1'
21
+ s.add_development_dependency 'webmock', '~> 3.25.1'
23
22
 
24
23
  s.metadata['rubygems_mfa_required'] = 'true'
25
24
  end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,3 @@
1
- if ENV['CI'] == 'true'
2
- require 'simplecov'
3
- require 'codecov'
4
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
5
- SimpleCov.start do
6
- add_filter '/spec/'
7
- end
8
- end
9
-
10
1
  require 'rspec'
11
2
  require 'octoauth'
12
3
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octoauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-23 00:00:00.000000000 Z
11
+ date: 2025-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.22.0
19
+ version: 10.0.0
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: 4.22.0
26
+ version: 10.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: userinput
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,48 +44,50 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.9.5
47
+ version: 0.9.7
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.9.5
54
+ version: 0.9.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: vcr
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.0.0
61
+ version: 6.3.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.0.0
68
+ version: 6.3.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 3.7.6
75
+ version: 3.25.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 3.7.6
82
+ version: 3.25.1
83
83
  description: Lightweight wrapper to sanely handle OAuth tokens with Octokit
84
84
  email: me@lesaker.org
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
88
88
  files:
89
+ - ".github/exporter.sh"
90
+ - ".github/workflows/build.yml"
89
91
  - ".gitignore"
90
92
  - ".rspec"
91
93
  - ".rubocop.yml"
@@ -106,7 +108,6 @@ files:
106
108
  - spec/fixtures/cassettes/recreate_token.yml
107
109
  - spec/fixtures/cassettes/requesting_scopes.yml
108
110
  - spec/fixtures/cassettes/write_to_first_file.yml
109
- - spec/octoauth/auth_spec.rb
110
111
  - spec/octoauth/configfile_spec.rb
111
112
  - spec/octoauth_spec.rb
112
113
  - spec/spec_helper.rb
@@ -115,7 +116,7 @@ licenses:
115
116
  - MIT
116
117
  metadata:
117
118
  rubygems_mfa_required: 'true'
118
- post_install_message:
119
+ post_install_message:
119
120
  rdoc_options: []
120
121
  require_paths:
121
122
  - lib
@@ -123,27 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
124
  requirements:
124
125
  - - ">="
125
126
  - !ruby/object:Gem::Version
126
- version: 2.5.0
127
+ version: '2.6'
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
130
  - - ">="
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  requirements: []
133
- rubygems_version: 3.3.7
134
- signing_key:
134
+ rubygems_version: 3.3.27
135
+ signing_key:
135
136
  specification_version: 4
136
137
  summary: Auth token helper for GitHub API
137
- test_files:
138
- - spec/examples/existing_token.yml
139
- - spec/fixtures/cassettes/alternate_endpoints.yml
140
- - spec/fixtures/cassettes/autosaving_config_file.yml
141
- - spec/fixtures/cassettes/create_token.yml
142
- - spec/fixtures/cassettes/handle_two_factor.yml
143
- - spec/fixtures/cassettes/recreate_token.yml
144
- - spec/fixtures/cassettes/requesting_scopes.yml
145
- - spec/fixtures/cassettes/write_to_first_file.yml
146
- - spec/octoauth/auth_spec.rb
147
- - spec/octoauth/configfile_spec.rb
148
- - spec/octoauth_spec.rb
149
- - spec/spec_helper.rb
138
+ test_files: []
@@ -1,150 +0,0 @@
1
- require 'spec_helper'
2
- require 'fileutils'
3
-
4
- ##
5
- # Grab creds for setting up VCR
6
- LOGIN = ENV['OCTOAUTH_LOGIN'] || 'user'
7
- PASSWORD = ENV['OCTOAUTH_PASSWORD'] || 'pw'
8
- TWOFACTOR = ENV['OCTOAUTH_TFA'] || '123456'
9
-
10
- describe Octoauth do
11
- describe Octoauth::Auth do
12
- describe '#initialize' do
13
- context 'if the file and note already exist' do
14
- it 'loads the existing token' do
15
- VCR.use_cassette('load_existing_token') do
16
- auth = Octoauth::Auth.new(
17
- note: 'existing_token',
18
- file: 'spec/examples/existing_token.yml'
19
- )
20
- expect(auth.token).to eql 'an_existing_token'
21
- end
22
- end
23
- end
24
- context 'if there is a note conflict' do
25
- it 'recreates the token' do
26
- VCR.use_cassette('recreate_token') do
27
- tokens = (1..2).map do
28
- Octoauth::Auth.new(
29
- note: 'existing_token',
30
- login: LOGIN,
31
- password: PASSWORD
32
- ).token
33
- end
34
- expect(tokens.first).not_to eql tokens.last
35
- end
36
- end
37
- end
38
- context 'if the file does not exist' do
39
- it 'use user input to create token' do
40
- VCR.use_cassette('create_token') do
41
- auth = Octoauth::Auth.new(
42
- note: 'create_token',
43
- login: LOGIN,
44
- password: PASSWORD
45
- )
46
- expect(auth.token).to eql 'created_token'
47
- end
48
- end
49
- it 'handles users with 2 factor auth enabled' do
50
- VCR.use_cassette('handle_two_factor') do
51
- auth = Octoauth::Auth.new(
52
- note: 'two_factor_token',
53
- login: LOGIN,
54
- password: PASSWORD,
55
- twofactor: TWOFACTOR
56
- )
57
- expect(auth.token).to eql '2fa_required_token'
58
- end
59
- end
60
- end
61
- it 'supports alternate endpoints' do
62
- VCR.use_cassette('alternate_endpoints') do
63
- auth = Octoauth::Auth.new(
64
- note: 'alternate_endpoint',
65
- login: LOGIN,
66
- password: PASSWORD,
67
- api_endpoint: 'https://example.org/api/v3/'
68
- )
69
- expect(auth.token).to eql 'created_token'
70
- end
71
- end
72
- it 'supports requesting scopes' do
73
- VCR.use_cassette('requesting_scopes') do
74
- auth = Octoauth::Auth.new(
75
- note: 'requesting_scopes',
76
- login: LOGIN,
77
- password: PASSWORD,
78
- scopes: %w[gist delete_repo]
79
- )
80
- expect(auth.token).to eql 'token_with_scopes'
81
- end
82
- end
83
- it 'supports autosaving the config file' do
84
- VCR.use_cassette('autosaving_config_file') do
85
- FileUtils.rm_f 'spec/examples/autosave.yml'
86
- Octoauth::Auth.new(
87
- note: 'autosave_test',
88
- file: 'spec/examples/autosave.yml',
89
- login: LOGIN,
90
- password: PASSWORD,
91
- autosave: true
92
- )
93
- new_auth = Octoauth::Auth.new(
94
- note: 'autosave_test',
95
- file: 'spec/examples/autosave.yml'
96
- )
97
- expect(new_auth.token).to eql 'autosaved_token'
98
- end
99
- end
100
- end
101
- context 'when given multiple file paths' do
102
- context 'when the first file exists' do
103
- it 'reads the first file' do
104
- auth = Octoauth::Auth.new(
105
- note: 'existing_token',
106
- files: ['spec/examples/existing_token.yml', 'bogus.yml']
107
- )
108
- expect(auth.token).to eql 'an_existing_token'
109
- end
110
- end
111
- context 'when the first file does not exist' do
112
- context 'when the second file exists' do
113
- it 'reads the second file' do
114
- auth = Octoauth::Auth.new(
115
- note: 'existing_token',
116
- files: ['bogus.yml', 'spec/examples/existing_token.yml']
117
- )
118
- expect(auth.token).to eql 'an_existing_token'
119
- end
120
- end
121
- context 'when the second file does not exist' do
122
- it 'reads nil from the first file' do
123
- auth = Octoauth::Auth.new(
124
- note: 'nonexistent_token',
125
- files: ['nil.yml', 'nil2.yml']
126
- )
127
- expect(auth.send(:config).token).to be_nil
128
- end
129
- it 'writes to the first file' do
130
- VCR.use_cassette('write_to_first_file') do
131
- FileUtils.rm_f 'spec/examples/write_first_test.yml'
132
- auth = Octoauth::Auth.new(
133
- note: 'write_first_test',
134
- files: ['spec/examples/write_first_test.yml', 'bogus.yml'],
135
- login: LOGIN,
136
- password: PASSWORD
137
- )
138
- auth.save
139
- new_auth = Octoauth::Auth.new(
140
- note: 'write_first_test',
141
- file: 'spec/examples/write_first_test.yml'
142
- )
143
- expect(new_auth.token).to eql 'write_first_test_token'
144
- end
145
- end
146
- end
147
- end
148
- end
149
- end
150
- end