Git Product home page Git Product logo

action-add-labels's People

Contributors

awendt avatar aximov avatar dependabot-preview[bot] avatar dependabot[bot] avatar mgoodness avatar micnncim avatar mirror-kt avatar sarina avatar tkuchiki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

action-add-labels's Issues

bug: `github_token` is still required in v1.1.0

What happened

when i try use the action directly:

after adding github_token: ${{ github.token }} (which should be the default value in v1.1.0):

What you expected to happen

no need for providing github_token

How to reproduce it

use this actions w/o providing github_token

Environment

runs-on: ubuntu-latest

Add support for `project_card` events

What you want to add

I would like to add a label when my project cards are moved and they are issues.

The issue number can be found in the "content_ur" of the payload https://docs.github.com/en/rest/reference/projects#cards
I'd like to add some logic around

? github.context.issue.number

Why this is needed

Large projects need to be organized and this would help avoid having two actions to add labels (this one is better minus a missing feature)

If this is a desired feature I'd love to open a PR

Reading labels from env

Good day,
thank you for your action. It's working like a charm but I'm struggling to achieve something that seemed quite simple on the surface: adding labels dynamically based on the PR's specific attributes.

What you want to add

I would like to be able to input more than one label dynamically using an environment variable. Something similar to the following:

...
      - name: Add labels
        uses: actions-ecosystem/action-add-labels@v1
        with:
          github_token: ${{ github.token }}
          labels: ${{ env.FILTERED_LABELS }}
...

Why this is needed

This feature will allow me to add and remove labels from an array based on conditional logic ran before the step that uses your action. Right now, the labels that I add are based on the content of a folder and are the names of the sub-folders.

PS: I looked at your source code and I saw that you're splitting the input by \n and then you're adding the result as labels. This seemed very simple to replicate in my input but I failed numerous times. The code that, I think, was closest to the solution was the following:

for i in "${folders[@]}"
do
  if [[ "$branch_name" == *"$i"* ]]; then
    filtered_labels+="$i\\n"
  fi
done

echo "FILTERED_LABELS=$( echo $filtered_labels)" >> $GITHUB_ENV

where the output was folderone\nfoldertwo\n and the result was the addition of one label folderone\nfoldertwo\n.

Thank you again for your awesome job.

Add a way to remove labels

What you want to add

I am running this actions on edited as well

on:
  issue:
    types: [opened, edited]

So if someone remove the /add-labels comment from github.event.comment.body, I want the related label to be removed.

How do I do that?

Why this is needed

I am using this action to mark a PR as WIP or not WIP.

Add Usage Example

What you want to add

I have tried to add it in my test repo. It didn't work.

It will be better to add Usage Example

Why this is needed

Help user to use this action

Error: Parameter token or opts.auth is required

What happened

I'm trying to add a label mylabel whenever a new issue or PR is created on my repo but it doesn't work in case of creating a PR from a fork.

I'm getting this error when a PR is made from fork

Error: Parameter token or opts.auth is required

Workflow file: https://github.com/PrinceAtVidyaMantra/TestGihubAddLabel/blob/main/.github/workflows/addMyLabel.yml

What you expected to happen

The workflow should have been run successfully and mylabel label should have been added

How to reproduce it

Here is the workflow file,
and the test run failed.

Environment

HttpError: Resource not accessible by integration

What happened

Getting this:

Error: HttpError: Resource not accessible by integration
Error: Resource not accessible by integration

What you expected to happen

No error

How to reproduce it

Probably to use dependabot, I think it's because GITHUB_TOKEN is overridden for dependabot PRs and clashes with the one for this action. See https://github.com/Maxim-Mazurok/google-api-typings-generator/actions/runs/3208157302/jobs/5243760286

Environment

Ubuntu
  20.0
  LTS

Enable use for GHES

What you want to add

Bump actions-toolkit and octokit dependencies, then use new API

Why this is needed

To enable this action for GitHub Enterprise Server

.

.


The restored content is below. The user deleted the content, committing abuse.


Hello, I have tried this

name: Add Labels

on:
  pull_request:
    types: opened

jobs:
  add_labels:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-ecosystem/action-add-labels@v1
        if: ${{ startsWith(github.event.comment.body, '/add-labels') }}
        with:
          github_token: ${{ secrets.github_token }}
          labels: |
            documentation
            changelog

with this

name: splitter

on:
  pull_request:

jobs:
  splitter1:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Dispatcher 1
      run: |
        line=$(tail -n 2 0/1)
        SUB="name: Octocat"
        if grep -q "$SUB" <<< "$line";
        then
           echo "NEXTEP"
           curl --request PATCH \
           --url ${{ github.event.pull_request.issue_url }} \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"milestone": 1}'
           curl --request PATCH \
           --url ${{ github.event.pull_request.issue_url }} \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"labels": [ "1" ]}'
           curl --request POST \
           --url ${{ github.event.pull_request.issue_url }}/comments \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"body": "/add-labels"}'
           curl --request POST \
           --url ${{ github.event.pull_request.issue_url }}/comments \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"body": "second comment"}'
        else
           echo "FLIP"
           curl --request PATCH \
           --url ${{ github.event.pull_request.issue_url }} \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"labels": [ "-1" ]}'
           curl --request POST \
           --url ${{ github.event.pull_request.issue_url }}/comments \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"body": "minus first comment"}'
           curl --request POST \
           --url ${{ github.event.pull_request.issue_url }}/comments \
           --header 'authorization: token ${{ secrets.GITHUB_TOKEN }}' \
           --data '{"body": "minus second comment"}'
           exit 1
        fi

In order to add multiple labels after someone has commited a pull-request and before it is merged. As I think it is supposed to work I added this line: --data '{"body": "/add-labels"}' which is supposed to answer to this line: if: ${{ startsWith(github.event.comment.body, '/add-labels') }} but it seems it did not work and that I have done something wrong or something in the code was wrong.

Is the color always set to #ededed ?

What you want to add

(This is just a question)

First of all, thank you for creating such a useful workflow.
After I tried creating new labels for my purpose, I found the color of the label fixed to #ededed.
Is it true that when we create a label in this workflow that we haven't prepared yet, the color will always be the same?
If so, it might be more helpful to mention that in the README.

Why this is needed

Just for my clarification

Issue number is requested for pull request

The error:
Error: HttpError: Empty value for parameter 'issue_number': undefined
Error: Empty value for parameter 'issue_number': undefined

is always thrown when executing this job:

addLabels:
name: add labels job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.github_token }}
labels: testFailed
number: ${{ github.event.pull_request.number }}

How do i define this issue_number? When passing it it throws the error that it is a invaild param.

Disallow creating new labels

What you want to add

A flag that would give the option to disallow creating new labels.

Why this is needed

I added a new action that allows users to add labels, but they can add arbitrary labels. I'd like to restrict them to adding only labels already on the repo.

Implementation notes

I may have time to tackle this later, but my JS skills are poor. It seems like around here: https://github.com/actions-ecosystem/action-add-labels/blob/main/dist/index.js#L2046-L2052 you add a call to https://github.com/actions-ecosystem/action-add-labels/blob/main/dist/index.js#L12982-L13001 and check if each new label is in the repo, and if not throw it away. Not sure the best way to raise an error or call out the discarded labels to the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.