Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): compatibility with v3alpha7 code #14

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
- name: api
color: 6f42c1
color: '#6f42c1'
description: Issues related to the GitHub API
- name: enhancement
color: 0dd8ac
color: '#0dd8ac'
description: New feature or improvement request
- name: high-priority
color: ff7b72
color: '#ff7b72'
description: Issue with high priority
- name: dependency
color: dadada
color: '#dadada'
description: Dependency updates
- name: question
color: ffb000
color: '#ffb000'
description: Questions or need for further clarification
- name: test
color: ffffff
color: '#ffffff'
description: "Test label. \U0001F6A7"
- name: invalid
color: e4e669
color: '#e4e669'
description: Issue is no longer valid or applicable
- name: duplicate
color: cfd3d7
color: '#cfd3d7'
description: Issue already reported or duplicated
- name: feature-request
color: 61dafb
color: '#61dafb'
description: Request for a new feature or enhancement
- name: feedback
color: d4c5f9
color: '#d4c5f9'
description: Feedback or suggestions for improvement
- name: help-wanted
color: 7057ff
color: '#7057ff'
description: Contribution opportunities available
- name: in-progress
color: 2a8b9d
color: '#2a8b9d'
description: Issue currently being worked on
- name: testing
color: 36bcef
color: '#36bcef'
description: Issues related to testing or test cases
- name: ¯\_(ツ)_/¯
color: f9d0c4
color: '#f9d0c4'
description: ¯\\\_(ツ)_/¯
- name: critical
color: e00808
color: '#e00808'
description: Critical issue that requires immediate attention
- name: documentation
color: 007bc7
color: '#007bc7'
description: Issues related to documentation
- name: hacktoberfest
color: ff6b00
color: '#ff6b00'
description: Issues related to the Hacktoberfest event
- name: resolved
color: 28a745
color: '#28a745'
description: Issue has been resolved
- name: bug
color: d73a4a
color: '#d73a4a'
description: Something isn't working as expected
- name: low-priority
color: 8c8c8c
color: '#8c8c8c'
description: Issue with low priority
- name: wontfix
color: a2eeef
color: '#a2eeef'
description: Issue won't be fixed or addressed
20 changes: 6 additions & 14 deletions .github/workflows/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ on:
paths:
- .github/labels.yml

permissions: write-all

env:
OWNER: shanduur
REPO: ${{ github.event.repository.name }}

jobs:
upload-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- run: go install github.com/shanduur/labeler/cmd/labeler@main
- run: labeler upload --owner ${{ env.OWNER }} --repo ${{ env.REPO }} ./.github/labels.yaml
env:
LABELER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: shanduur/declarative-labels-sync-action@main
with:
owner: shanduur
repository: ${{ github.event.repository.name }}
token: ${{ secrets.PAT }}
1 change: 1 addition & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ jobs:
- uses: google-github-actions/release-please-action@v3
with:
release-type: go
token: ${{ secrets.PAT }}
10 changes: 5 additions & 5 deletions cmd/labeler/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ func New() *cli.Command {
Flags: []cli.Flag{
flagOutput,
},
Action: func(ctx *cli.Context) error {
if ctx.Args().Len() == 0 {
Action: func(ctx context.Context, cmd *cli.Command) error {
if cmd.Args().Len() == 0 {
return errors.New("nothing to do")
}

client := github.NewClient(nil)

for i := 0; i < ctx.NArg(); i++ {
ghPath := ctx.Args().Get(i)
for i := 0; i < cmd.NArg(); i++ {
ghPath := cmd.Args().Get(i)
owner, repo := getOwnerRepo(ghPath)

l, err := listAll(ctx.Context, client, owner, repo)
l, err := listAll(ctx, client, owner, repo)
if err != nil {
return fmt.Errorf("unable to list all: %w", err)
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/labeler/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func New() *cli.Command {
flagOwner,
flagRepo,
},
Action: func(ctx *cli.Context) error {
if ctx.Args().Len() != 1 {
Action: func(ctx context.Context, cmd *cli.Command) error {
if cmd.Args().Len() != 1 {
return errors.New("wrong number of arguments, expected single <file>")
}

Expand All @@ -54,11 +54,11 @@ func New() *cli.Command {
&oauth2.Token{AccessToken: token},
)

tc := oauth2.NewClient(ctx.Context, ts)
tc := oauth2.NewClient(ctx, ts)

client := github.NewClient(tc)

f, err := os.Open(ctx.Args().First())
f, err := os.Open(cmd.Args().First())
if err != nil {
return fmt.Errorf("unable to open file: %w", err)
}
Expand All @@ -73,7 +73,7 @@ func New() *cli.Command {
for _, label := range lbls {
slog.Info("processing label", "label_name", label.Name, "label.color", label.Color)

err = uploadLabel(ctx.Context, client, owner, repo, label)
err = uploadLabel(ctx, client, owner, repo, label)
if err != nil {
return fmt.Errorf("unable to update label: %w", err)
}
Expand Down
Loading