Skip to content

Commit 36cca22

Browse files
authored
Upgrade baton-sdk to v0.4.2. Fix lint errors. (#105)
* Upgrade baton-sdk to v0.4.2. Fix lint errors. * Add a CI test. * Fix CI test.
1 parent 0bb8268 commit 36cca22

File tree

101 files changed

+11262
-1884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+11262
-1884
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,55 @@ jobs:
44
go-lint:
55
runs-on: ubuntu-latest
66
steps:
7+
- name: Checkout code
8+
uses: actions/checkout@v4
79
- name: Install Go
8-
uses: actions/setup-go@v4
10+
uses: actions/setup-go@v5
911
with:
10-
go-version: 1.23.x
11-
- name: Checkout code
12-
uses: actions/checkout@v3
12+
go-version-file: go.mod
1313
- name: Run linters
1414
uses: golangci/golangci-lint-action@v8
1515
with:
16-
version: v2.1.6
16+
version: latest
1717
args: --timeout=3m
1818
go-test:
1919
strategy:
2020
matrix:
21-
go-version: [1.23.x]
2221
platform: [ubuntu-latest]
2322
runs-on: ${{ matrix.platform }}
2423
steps:
25-
- name: Install Go
24+
- name: Checkout code
2625
if: success()
27-
uses: actions/setup-go@v4
26+
uses: actions/checkout@v4
27+
- name: Install Go
28+
uses: actions/setup-go@v5
2829
with:
29-
go-version: ${{ matrix.go-version }}
30-
- name: Checkout code
31-
uses: actions/checkout@v3
30+
go-version-file: go.mod
3231
- name: go tests
3332
run: go test -v -covermode=count -json ./... > test.json
3433
- name: annotate go tests
3534
if: always()
3635
uses: guyarb/[email protected]
3736
with:
38-
test-results: test.json
37+
test-results: test.json
38+
ci:
39+
runs-on: ubuntu-latest
40+
env:
41+
BATON_TOKEN: ${{ secrets.BATON_TOKEN }}
42+
BATON_ORGS: ConductorOne
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
- name: Install Go
47+
uses: actions/setup-go@v5
48+
with:
49+
go-version-file: go.mod
50+
- name: Build baton-github
51+
run: go build ./cmd/baton-github
52+
- name: Grant/revoke
53+
uses: ConductorOne/github-workflows/actions/sync-test@v2
54+
with:
55+
connector: ./baton-github
56+
baton-entitlement: 'repository:642588514:triage'
57+
baton-principal: '166871869'
58+
baton-principal-type: 'user'

.github/workflows/main.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
go-lint:
88
runs-on: ubuntu-latest
99
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
1012
- name: Install Go
1113
uses: actions/setup-go@v5
1214
with:
13-
go-version: 1.23.x
14-
- name: Checkout code
15-
uses: actions/checkout@v4
15+
go-version-file: go.mod
1616
- name: Run linters
1717
uses: golangci/golangci-lint-action@v8
1818
with:
@@ -21,17 +21,16 @@ jobs:
2121
go-test:
2222
strategy:
2323
matrix:
24-
go-version: [ 1.23.x ]
2524
platform: [ ubuntu-latest ]
2625
runs-on: ${{ matrix.platform }}
2726
steps:
28-
- name: Install Go
27+
- name: Checkout code
2928
if: success()
29+
uses: actions/checkout@v4
30+
- name: Install Go
3031
uses: actions/setup-go@v5
3132
with:
32-
go-version: ${{ matrix.go-version }}
33-
- name: Checkout code
34-
uses: actions/checkout@v4
33+
go-version-file: go.mod
3534
- name: go tests
3635
run: go test -v -covermode=count -json ./... > test.json
3736
- name: annotate go tests

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module github.com/conductorone/baton-github
22

3-
go 1.23.4
3+
go 1.25
44

55
require (
6-
github.com/conductorone/baton-sdk v0.3.30
6+
github.com/conductorone/baton-sdk v0.4.2
77
github.com/deckarep/golang-set/v2 v2.8.0
88
github.com/ennyjfrick/ruleguard-logfatal v0.0.2
99
github.com/golang-jwt/jwt/v5 v5.2.2
@@ -70,7 +70,7 @@ require (
7070
github.com/hashicorp/hcl v1.0.0 // indirect
7171
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7272
github.com/jellydator/ttlcache/v3 v3.3.0 // indirect
73-
github.com/klauspost/compress v1.17.11 // indirect
73+
github.com/klauspost/compress v1.18.0 // indirect
7474
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
7575
github.com/magiconair/properties v1.8.9 // indirect
7676
github.com/mattn/go-isatty v0.0.20 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
5858
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
5959
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
6060
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
61-
github.com/conductorone/baton-sdk v0.3.30 h1:KR6r1pMpssQW6EgcSMOvtmBpkd08KX1bGtvUUGSXqek=
62-
github.com/conductorone/baton-sdk v0.3.30/go.mod h1:L55WO3ERMx1mfpjDgwK3jWNRGRF2E76WrQHmW6ev8VY=
61+
github.com/conductorone/baton-sdk v0.4.2 h1:hj/aXdaz850EVqnErw9DN/+3864LSdVcwa6p3vMrAfI=
62+
github.com/conductorone/baton-sdk v0.4.2/go.mod h1:Csa1C2KrI4TxJAtC3WjQqOn24u0g2f4/5FgiYqZWpN4=
6363
github.com/conductorone/dpop v0.2.3 h1:s91U3845GHQ6P6FWrdNr2SEOy1ES/jcFs1JtKSl2S+o=
6464
github.com/conductorone/dpop v0.2.3/go.mod h1:gyo8TtzB9SCFCsjsICH4IaLZ7y64CcrDXMOPBwfq/3s=
6565
github.com/conductorone/dpop/integrations/dpop_grpc v0.2.3 h1:kLMCNIh0Mo2vbvvkCmJ3ixsPbXEJ6HPcW53Ku9yje3s=
@@ -155,8 +155,8 @@ github.com/jellydator/ttlcache/v3 v3.3.0 h1:BdoC9cE81qXfrxeb9eoJi9dWrdhSuwXMAnHT
155155
github.com/jellydator/ttlcache/v3 v3.3.0/go.mod h1:bj2/e0l4jRnQdrnSTaGTsh4GSXvMjQcy41i7th0GVGw=
156156
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
157157
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
158-
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
159-
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
158+
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
159+
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
160160
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
161161
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
162162
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=

pkg/connector/enterprise_role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (o *enterpriseRoleResourceType) Entitlements(
119119
entitlement.WithDisplayName(resource.DisplayName),
120120
entitlement.WithDescription(fmt.Sprintf("Assignment to %s enterprise role in GitHub", resource.DisplayName)),
121121
entitlement.WithAnnotation(&v2.V1Identifier{
122-
Id: fmt.Sprintf(resource.Id.Resource),
122+
Id: resource.Id.Resource,
123123
}),
124124
entitlement.WithGrantableTo(resourceTypeUser),
125125
))

pkg/connector/invitation.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ type invitationResourceType struct {
4545
orgs []string
4646
}
4747

48+
var _ connectorbuilder.AccountManager = &invitationResourceType{}
49+
4850
func (i *invitationResourceType) ResourceType(_ context.Context) *v2.ResourceType {
4951
return resourceTypeInvitation
5052
}
@@ -122,7 +124,7 @@ func (i *invitationResourceType) CreateAccountCapabilityDetails(ctx context.Cont
122124
func (i *invitationResourceType) CreateAccount(
123125
ctx context.Context,
124126
accountInfo *v2.AccountInfo,
125-
credentialOptions *v2.CredentialOptions,
127+
credentialOptions *v2.LocalCredentialOptions,
126128
) (
127129
connectorbuilder.CreateAccountResponse,
128130
[]*v2.PlaintextData,

vendor/github.com/conductorone/baton-sdk/internal/connector/connector.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.go

Lines changed: 45 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/annotation_resource_tree.pb.validate.go

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)