actions-ecosystem / action-add-labels Goto Github PK
View Code? Open in Web Editor NEW๐ท๏ธ GitHub Action to add labels
Home Page: https://github.com/marketplace/actions/actions-ecosystem-add-labels
License: Apache License 2.0
๐ท๏ธ GitHub Action to add labels
Home Page: https://github.com/marketplace/actions/actions-ecosystem-add-labels
License: Apache License 2.0
when i try use the action directly:
after adding github_token: ${{ github.token }}
(which should be the default value in v1.1.0
):
no need for providing github_token
use this actions w/o providing github_token
runs-on: ubuntu-latest
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
Line 15 in 288072f
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
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.
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 }}
...
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.
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?
I am using this action to mark a PR as WIP
or not WIP
.
I have tried to add it in my test repo. It didn't work.
It will be better to add Usage Example
Help user to use this action
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
The workflow should have been run successfully and mylabel
label should have been added
Here is the workflow file,
and the test run failed.
Getting this:
Error: HttpError: Resource not accessible by integration
Error: Resource not accessible by integration
No error
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
Ubuntu
20.0
LTS
Bump actions-toolkit and octokit dependencies, then use new API
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.
I'd like to specify color for labels
It helps on improving readability.
(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.
Just for my clarification
I forked the repo to make a version for editing (https://github.com/JEFuller/action-edit-label), but when npm run build
I get:
src/main.ts:22:31 - error TS2339: Property 'GitHub' does not exist on type 'typeof import("/home/dave/action-edit-label/node_modules/@actions/github/lib/github")'.
22 const client = new github.GitHub(githubToken);
~~~~~~
Any ideas?
Upgrade runner to use Nodejs 16.
Because the Nodejs 14 runner will get deprecated soon.
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.
Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.
A flag that would give the option to disallow creating new labels.
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.
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.
Use the action add label successfully, but once the label is added, which does not trigger the pull_request (labelled) event like I add label manually. is this supposed to work ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.