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

Tries to create label when label already exists #69

Closed
ces131 opened this issue Apr 6, 2020 · 24 comments · Fixed by #71
Closed

Tries to create label when label already exists #69

ces131 opened this issue Apr 6, 2020 · 24 comments · Fixed by #71
Labels

Comments

@ces131
Copy link

ces131 commented Apr 6, 2020

Hi! I've been testing out different action for syncing labels in a repo and your action lines up perfectly with what we need.

I keep running into an issue where the action doesn't recognize one of my labels right away. When running the action then it attempts to create the label then fails saying a label with that name already exists:

🎨 Creating 'wontfix' label with color 'ffffff' and desc 'This will not be worked on'
##[error]Validation Failed: {"resource":"Label","code":"already_exists","field":"name"}

The label is listed under my labels with the same fields above. All of the other labels are properly being skipped over, but I'm unsure why this one isn't?

I also tried using the from_name: with wontfix and it says the label can't be found in order to rename it.

Let me know if there's any more information you need to help with this or if you have any guidance/things to try to fix this issue! Thanks!

@crazy-max
Copy link
Owner

Hi @ces131,

Do you have a link to your repo/workflow please?

@ces131
Copy link
Author

ces131 commented Apr 6, 2020

Due to confidentiality I can't show the original repo, but I created a test one I can share. While trying to reproduce this, I ran into a different problem with the color field being flagged as nil for label17 Here's the link to the repo: https://github.com/ces131/WiCSRules

The latest run: https://github.com/ces131/WiCSRules/actions/runs/72109424
is showing an invalid request. Not sure if I have something set up incorrectly?

@crazy-max
Copy link
Owner

crazy-max commented Apr 6, 2020

@ces131

I ran into a different problem with the color field being flagged as nil for label17

See #4

...is showing an invalid request. Not sure if I have something set up incorrectly?

Your .github/labels/config.yml is malformed. Use double quotes for every values (see #4 too).

@ces131
Copy link
Author

ces131 commented Apr 6, 2020

Should every value have quotes (name, description, and color)? I noticed in the readme all of descriptions are in quotes and just the "00000" value for color is in quotes.

@crazy-max
Copy link
Owner

crazy-max commented Apr 6, 2020

@ces131

Should every value have quotes

Yes, it would be safer (I will update the README).

descriptions are in quotes and just the "00000" value for color is in quotes.

I deliberately put this color in double quotes because it would be interpreted as int and would cause an invalid request exception (see parameters type from GitHub API).

@ces131
Copy link
Author

ces131 commented Apr 6, 2020

Awesome, sounds great. I will fix this and confirm/close this issue. Thanks for your help!!

@crazy-max
Copy link
Owner

@ces131 You're welcome. Keep me in touch.

crazy-max added a commit that referenced this issue Apr 6, 2020
@ces131
Copy link
Author

ces131 commented Apr 6, 2020

Hmm I'm still running into the same original problem with it trying to create a label that already exists. The test repo I created isn't having the same issue, I'll keep messing with it/trying to recreate it

@crazy-max
Copy link
Owner

@ces131 Can you paste your workflow file and label.yml file and complete logs of the runner (without sensitive values) here?

@ces131
Copy link
Author

ces131 commented Apr 7, 2020

Here's the log of Running the labeler:

⚠️ Skipping update for 'bug' label. Same color and description
⚠️ Skipping rename 'duplicate' label to 'duplicate_update'. Already exists
⚠️ Skipping update for 'enhancement' label. Same color and description
⚠️ Skipping update for 'good first issue' label. Same color and description
⚠️ Skipping update for 'help wanted' label. Same color and description
⚠️ Skipping update for 'invalid' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
⚠️ Skipping update for '' label. Same color and description
🎨 Creating 'wontfix' label with color 'ddc261' and desc 'This will not be worked on'
##[error]Validation Failed: {"resource":"Label","code":"already_exists","field":"name"}
🔫 Deleting 'asldkf'

(removed the sensitive label names)

file of labels found in '.github/labels/config.yml:

- name: "HI THERE"
  color: "d8bcf4"
  description: "label added by the labeler"
- name: "Epic"
  color: "d8bcf4"
  description: ""
- name: "stale"
  color: "d8bcf4"
  description: "This PR/issue is stale and will be deleted in 3 days if the label isn't removed"
- name: "never stale"
  color: "d8bcf4"
  description: "Never mark this PR/issue as stale"
- name: "bug"
  color: "d73a4a"
  description: "Something isn't working"
- name: "duplicate_update"
  color: "cfd3d7"
  description: "This issue or pull request already exists"
  from_name: "duplicate"
- name: "enhancement"
  color: "a2eeef"
  description: "New feature or request"
- name: "good first issue"
  color: "7057ff"
  description: "Good for newcomers"
- name: "help wanted"
  color: "008672"
  description: "Extra attention is needed"
- name: "invalid"
  color: "e4e669"
  description: "This doesn't seem right"
- name: "mp-rna"
  color: "29af1f"
  description: ""
- name: ""
  color: "bfd4f2"
  description: ""
- name: "question"
  color: "d876e3"
  description: "Further information is requested"
- name: ""
  color: "b7f7a0"
  description: ""
- name: ""
  color: "0052cc"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "6fea54"
  description: ""
- name: ""
  color: "d8cb0f"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "82ED88"
  description: ""
- name: ""
  color: "42cc0c"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "84ed84"
  description: ""
- name: ""
  color: "88e579"
  description: ""
- name: ""
  color: "ddc261"
  description: ""
- name: "wontfix"
  color: "ddc261"
  description: "This will not be worked on"

and the workflow file:

name: Sync labels

on:
  push:
    branches: 
      - master
    paths:
      -.github/labels/config.yml
  label:
    types: [created, edited, deleted]

jobs:
  labeler:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v1
      -
        name: Run Labeler
        if: success()
        uses: crazy-max/ghaction-github-labeler@v1
        with:
          yaml_file: .github/labels/config.yml
          skip_delete: false
          dry_run: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

the action was triggered when I attempted to add a new label using the github UI

@crazy-max
Copy link
Owner

crazy-max commented Apr 7, 2020

@ces131 Can you give me the current config of wontfix label in the 👉 Current labels output logs?

@haltcase

This comment has been minimized.

@crazy-max

This comment has been minimized.

@ces131
Copy link
Author

ces131 commented Apr 7, 2020

It doesn't show up under current labels actually @crazy-max

It shows the label before it as the last one

I also tried swapping the order of the tags in the config.yml file with no luck. If I directly update the wontfix label using the web UI it will successfully do the update and raise no fails

@crazy-max
Copy link
Owner

@ces131 How many labels do you have on this repo? (> 100?)

@ces131
Copy link
Author

ces131 commented Apr 7, 2020

@crazy-max There are only 30 labels, but if it we can get it working we plan to use it in a repo with around 250 labels

@crazy-max
Copy link
Owner

@ces131 Can you test with uses: crazy-max/ghaction-github-labeler@labels-paginate please?

@ces131
Copy link
Author

ces131 commented Apr 8, 2020

Did I put it in the workflow file correctly?/how you're suggesting? :

name: Sync labels

on:
  push:
    branches: 
      - master
    paths:
      - .github/labels/config.yml
  label:
    types: [created, edited, deleted]

jobs:
  labeler:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v1
      -
        name: Run Labeler
        if: success()
        uses: crazy-max/ghaction-github-labeler@labels-paginate
        with:
          yaml_file: .github/labels/config.yml
          skip_delete: false
          dry_run: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

If so, I'm getting this error:

##[error]Could not find file '/home/runner/work/_actions/_temp_acd8bcaf-d6d6-4880-bf03-f38e348b020b/_staging/crazy-max-ghaction-github-labeler-b8a8a09/node_modules/.bin/esparse'.

sorry for the delay. there was a pretty big power outage

@crazy-max
Copy link
Owner

crazy-max commented Apr 8, 2020

Hi @ces131, yes your workflow is correct, can you try again?

@ces131
Copy link
Author

ces131 commented Apr 8, 2020

It works! It's recognizing the label and skipping over it. @crazy-max

@crazy-max
Copy link
Owner

Ok nice! I will merge this branch and create a new release, keep you in touch!

@ces131
Copy link
Author

ces131 commented Apr 8, 2020

@crazy-max awesome, thanks so much! Really appreciate all of the work 💯

@crazy-max
Copy link
Owner

@ces131 Should be ok to bring back crazy-max/ghaction-github-labeler@v1

@ces131
Copy link
Author

ces131 commented Apr 8, 2020

@crazy-max cool! thanks again!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants