elelem-github 0.1.0 → 0.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
- data/.github/workflows/release.yml +0 -10
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +11 -0
- data/README.md +2 -2
- data/lib/elelem/github/version.rb +1 -1
- data/lib/elelem/github.rb +2 -2
- data/spec/elelem/github/registration_spec.rb +18 -10
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54641c93da46120d60a89d770f1eaa0ff7089e9c2c795f3428d0f606002197b0
|
|
4
|
+
data.tar.gz: 96256b2a8a9763c7a93d509db4aa1565b511f5479843f861a08ef01ab774d322
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e7c34bd1f658b7f593a9eb9f1a4415552cad57ca225178bc1e903ef4cbdceb44cacfbbed4055fe21316b2d304fcff3e854140a1dbbed0eb4bc964abb2d437f2
|
|
7
|
+
data.tar.gz: a67b5663294b6564d3e44868f8fce6a8f5792db1d2d16360fba61439c392061adfd1e40eea4b92a9d607b5da513cab7c82b305bb0687537f3930e9ff5534c7fc
|
|
@@ -59,16 +59,6 @@ jobs:
|
|
|
59
59
|
with:
|
|
60
60
|
ruby-version: "4.0"
|
|
61
61
|
bundler-cache: true
|
|
62
|
-
- shell: bash
|
|
63
|
-
run: |
|
|
64
|
-
set -euo pipefail
|
|
65
|
-
jwt=$(curl -sS --fail-with-body -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=rubygems.org" | jq -r .value)
|
|
66
|
-
echo "::add-mask::$jwt"
|
|
67
|
-
key=$(jq -n --arg jwt "$jwt" '{jwt: $jwt, owner: "66898"}' | curl -sS --fail-with-body -H "content-type: application/json" -d @- https://rubygems.org/api/v1/oidc/trusted_publisher/exchange_token | jq -r .rubygems_api_key)
|
|
68
|
-
test -n "$key" -a "$key" != null
|
|
69
|
-
echo "::add-mask::$key"
|
|
70
|
-
printf 'GEM_HOST_API_KEY=%s\nBUNDLE_GEM__PUSH_KEY=%s\nRUBYGEMS_API_KEY=%s\n' "$key" "$key" "$key" >> "$GITHUB_ENV"
|
|
71
62
|
- uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
|
|
72
63
|
with:
|
|
73
|
-
setup-trusted-publisher: false
|
|
74
64
|
await-release: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.0](https://github.com/elelem-sh/github/compare/v0.1.0...v0.2.0) (2026-11-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* read GH_TOKEN or GITHUB_TOKEN, the names gh and GitHub Models use, instead of GITHUB_API_KEY
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* read GH_TOKEN or GITHUB_TOKEN, the names gh and GitHub Models use, instead of GITHUB_API_KEY ([27f18cc](https://github.com/elelem-sh/github/commit/27f18cce15c53a180cca7d58e77c6c7e8963b601))
|
|
13
|
+
|
|
3
14
|
## 0.1.0 (2026-11-16)
|
|
4
15
|
|
|
5
16
|
|
data/README.md
CHANGED
|
@@ -13,11 +13,11 @@ gem install elelem-github
|
|
|
13
13
|
## Use
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
export
|
|
16
|
+
export GITHUB_TOKEN=...
|
|
17
17
|
elelem -p github --model MODEL
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
* `
|
|
20
|
+
* `GH_TOKEN` or `GITHUB_TOKEN` (required, `GH_TOKEN` wins, as in `gh`): a GitHub token with the `models:read` permission, from https://github.com/settings/tokens
|
|
21
21
|
* `GITHUB_MODEL`: the model, when `--model` is not given
|
|
22
22
|
* `GITHUB_BASE_URL`: overrides `https://models.github.ai/inference`
|
|
23
23
|
|
data/lib/elelem/github.rb
CHANGED
|
@@ -8,8 +8,8 @@ Elelem.configure do |config|
|
|
|
8
8
|
config.provider(:github) do |model: nil, **|
|
|
9
9
|
# A variable that is set but empty counts as unset.
|
|
10
10
|
env = ->(name) { ENV[name].to_s.strip.then { |v| v.empty? ? nil : v } }
|
|
11
|
-
key = env.call("
|
|
12
|
-
raise KeyError, "
|
|
11
|
+
key = env.call("GH_TOKEN") || env.call("GITHUB_TOKEN")
|
|
12
|
+
raise KeyError, "GH_TOKEN or GITHUB_TOKEN is not set" if key.nil?
|
|
13
13
|
|
|
14
14
|
model = env.call("GITHUB_MODEL") if model.to_s.strip.empty?
|
|
15
15
|
raise KeyError, "GITHUB_MODEL is not set. Pass --model or set GITHUB_MODEL" if model.nil?
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe "the github provider" do
|
|
4
4
|
around do |example|
|
|
5
|
-
saved = ENV.to_h.slice("
|
|
5
|
+
saved = ENV.to_h.slice("GH_TOKEN", "GITHUB_TOKEN", "GITHUB_BASE_URL", "GITHUB_MODEL")
|
|
6
6
|
example.run
|
|
7
7
|
ensure
|
|
8
|
-
%w[
|
|
8
|
+
%w[GH_TOKEN GITHUB_TOKEN GITHUB_BASE_URL GITHUB_MODEL].each { |k| ENV.delete(k) }
|
|
9
9
|
ENV.update(saved)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
before do
|
|
13
|
-
ENV
|
|
13
|
+
ENV.delete("GH_TOKEN")
|
|
14
|
+
ENV["GITHUB_TOKEN"] = "test-key"
|
|
14
15
|
ENV["GITHUB_MODEL"] = "env-model"
|
|
15
16
|
ENV.delete("GITHUB_BASE_URL")
|
|
16
17
|
end
|
|
@@ -18,6 +19,7 @@ RSpec.describe "the github provider" do
|
|
|
18
19
|
def build(**) = Elelem::Config.build_provider("github", **)
|
|
19
20
|
def uri(**) = build(**).instance_variable_get(:@uri).to_s
|
|
20
21
|
def model(**) = build(**).instance_variable_get(:@model)
|
|
22
|
+
def key = build.instance_variable_get(:@api_key)
|
|
21
23
|
|
|
22
24
|
it "registers provider github" do
|
|
23
25
|
expect(Elelem::Config.names).to include("github")
|
|
@@ -28,16 +30,22 @@ RSpec.describe "the github provider" do
|
|
|
28
30
|
expect(uri).to eq("https://models.github.ai/inference/chat/completions")
|
|
29
31
|
end
|
|
30
32
|
|
|
31
|
-
it "sends
|
|
32
|
-
expect(
|
|
33
|
+
it "sends GITHUB_TOKEN" do
|
|
34
|
+
expect(key).to eq("test-key")
|
|
33
35
|
end
|
|
34
36
|
|
|
35
|
-
it "
|
|
36
|
-
ENV
|
|
37
|
-
expect
|
|
37
|
+
it "prefers GH_TOKEN over GITHUB_TOKEN, as gh does" do
|
|
38
|
+
ENV["GH_TOKEN"] = "gh-key"
|
|
39
|
+
expect(key).to eq("gh-key")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "names both variables when the token is missing or empty" do
|
|
43
|
+
ENV.delete("GITHUB_TOKEN")
|
|
44
|
+
expect { build }.to raise_error(KeyError, /GH_TOKEN or GITHUB_TOKEN/)
|
|
38
45
|
|
|
39
|
-
ENV["
|
|
40
|
-
|
|
46
|
+
ENV["GITHUB_TOKEN"] = " "
|
|
47
|
+
ENV["GH_TOKEN"] = ""
|
|
48
|
+
expect { build }.to raise_error(KeyError, /GH_TOKEN or GITHUB_TOKEN/)
|
|
41
49
|
end
|
|
42
50
|
|
|
43
51
|
it "names GITHUB_MODEL when no model is set, and treats an empty one as unset" do
|