Skip to content

Commit

Permalink
feat: removed duplicate names
Browse files Browse the repository at this point in the history
  • Loading branch information
shanduur committed Nov 23, 2023
1 parent db7bc8e commit f4d1a32
Show file tree
Hide file tree
Showing 8 changed files with 1,154 additions and 1,430 deletions.
136 changes: 60 additions & 76 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,60 @@
¯\_(ツ)_/¯:
name: ¯\_(ツ)_/¯
color: f9d0c4
description: ¯\\\_(ツ)_/¯
api:
name: api
color: 6f42c1
description: Issues related to the GitHub API
bug:
name: bug
color: d73a4a
description: Something isn't working as expected
enhancement:
name: enhancement
color: 0dd8ac
description: New feature or improvement request
documentation:
name: documentation
color: 007bc7
description: Issues related to documentation
help-wanted:
name: help-wanted
color: 7057ff
description: Contribution opportunities available
question:
name: question
color: ffb000
description: Questions or need for further clarification
invalid:
name: invalid
color: e4e669
description: Issue is no longer valid or applicable
duplicate:
name: duplicate
color: cfd3d7
description: Issue already reported or duplicated
wontfix:
name: wontfix
color: a2eeef
description: Issue won't be fixed or addressed
feature-request:
name: feature-request
color: 61dafb
description: Request for a new feature or enhancement
critical:
name: critical
color: e00808
description: Critical issue that requires immediate attention
high-priority:
name: high-priority
color: ff7b72
description: Issue with high priority
low-priority:
name: low-priority
color: 8c8c8c
description: Issue with low priority
in-progress:
name: in-progress
color: 2a8b9d
description: Issue currently being worked on
resolved:
name: resolved
color: 28a745
description: Issue has been resolved
feedback:
name: feedback
color: d4c5f9
description: Feedback or suggestions for improvement
testing:
name: testing
color: 36bcef
description: Issues related to testing or test cases
hacktoberfest:
name: hacktoberfest
color: ff6b00
description: Issues related to the Hacktoberfest event
- name: api
color: 6f42c1
description: Issues related to the GitHub API
- name: enhancement
color: 0dd8ac
description: New feature or improvement request
- name: high-priority
color: ff7b72
description: Issue with high priority
- name: question
color: ffb000
description: Questions or need for further clarification
- name: test
color: ffffff
description: "Test label. \U0001F6A7"
- name: invalid
color: e4e669
description: Issue is no longer valid or applicable
- name: duplicate
color: cfd3d7
description: Issue already reported or duplicated
- name: feature-request
color: 61dafb
description: Request for a new feature or enhancement
- name: feedback
color: d4c5f9
description: Feedback or suggestions for improvement
- name: help-wanted
color: 7057ff
description: Contribution opportunities available
- name: in-progress
color: 2a8b9d
description: Issue currently being worked on
- name: testing
color: 36bcef
description: Issues related to testing or test cases
- name: ¯\_(ツ)_/¯
color: f9d0c4
description: ¯\\\_(ツ)_/¯
- name: critical
color: e00808
description: Critical issue that requires immediate attention
- name: documentation
color: 007bc7
description: Issues related to documentation
- name: hacktoberfest
color: ff6b00
description: Issues related to the Hacktoberfest event
- name: resolved
color: 28a745
description: Issue has been resolved
- name: bug
color: d73a4a
description: Something isn't working as expected
- name: low-priority
color: 8c8c8c
description: Issue with low priority
- name: wontfix
color: a2eeef
description: Issue won't be fixed or addressed
6 changes: 5 additions & 1 deletion .github/workflows/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:

permissions: write-all

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

jobs:
upload-labels:
runs-on: ubuntu-latest
Expand All @@ -28,6 +32,6 @@ jobs:
- if: steps.labels-changed.outputs.changed == 'true'
run: go install github.com/shanduur/labeler/cmd/labeler@main
- if: steps.labels-changed.outputs.changed == 'true'
run: labeler upload --owner shanduur --repo labeler ./.github/labels.yaml
run: labeler upload --owner ${{ env.OWNER }} --repo ${{ env.REPO }} ./.github/labels.yaml
env:
LABELER_TOKEN: ${{ secrets.LABELER_TOKEN }}
4 changes: 2 additions & 2 deletions cmd/labeler/download/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func listAll(ctx context.Context, client *github.Client, owner, repo string) ([]
func toYAML(ghl []*github.Label) ([]byte, error) {
slog.Debug("transforming to YAML")

lbl := make(labels.Labels)
lbl := make(labels.LabelsMap)

for _, l := range ghl {
name := l.GetName()
Expand All @@ -132,7 +132,7 @@ func toYAML(ghl []*github.Label) ([]byte, error) {

slog.Debug("transforming to YAML complete")

out, err := yaml.Marshal(lbl)
out, err := yaml.Marshal(lbl.ToSlice())
if err != nil {
return nil, fmt.Errorf("unable to marshall YAML: %w", err)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/labeler/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ func New() *cli.Command {
return fmt.Errorf("unable to open file: %w", err)
}

lbls := make(labels.Labels)
var lbls labels.Labels

err = yaml.NewDecoder(f).Decode(&lbls)
if err != nil {
return fmt.Errorf("unable to decode file: %w", err)
}

for name, label := range lbls {
slog.Info("processing label", "label_name", name, "label.color", label.Color)
for _, label := range lbls {
slog.Info("processing label", "label_name", label.Name, "label.color", label.Color)

err = uploadLabel(ctx.Context, client, owner, repo, label)
if err != nil {
Expand Down
Loading

0 comments on commit f4d1a32

Please sign in to comment.