generated from actions/container-toolkit-action
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
232 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: Renato66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"recommendations": [ | ||
"streetsidesoftware.code-spell-checker", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Bun | ||
|
||
> [!NOTE] | ||
> You will need to have [bun](https://bun.sh/docs/installation) installed | ||
To install dependencies: | ||
|
||
```bash | ||
bun install | ||
``` | ||
|
||
To run: | ||
|
||
```bash | ||
bun run test | ||
``` | ||
|
||
This project was created using `bun init` in bun v1.1.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. | ||
|
||
# Docker | ||
|
||
> [!NOTE] | ||
> You will need to have [docker](https://www.docker.com/products/docker-desktop/) installed | ||
|
||
To create a docker image: | ||
|
||
``` | ||
docker build --pull -t auto-label . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018-2024 Renato Vicente and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,126 @@ | ||
# auto-label | ||
# Auto-label | ||
|
||
To install dependencies: | ||
![Unit test](https://github.com/Renato66/auto-label/workflows/Unit%20test/badge.svg) | ||
[![Auto Label](https://github.com/Renato66/auto-label/workflows/Labeling%20new%20issue/badge.svg)](https://github.com/Renato66/auto-label) | ||
[![codecov](https://codecov.io/gh/Renato66/auto-label/branch/master/graph/badge.svg)](https://codecov.io/gh/Renato66/auto-label) | ||
|
||
![image](https://user-images.githubusercontent.com/9284273/79672530-57c1db80-81a9-11ea-900c-3b4f73984e0a.png) | ||
|
||
The Auto label action will check for every new issue and automatically adds a label based on the body of the issue. This means that finding specifc issues will be much more easy. | ||
|
||
> [!WARNING] | ||
> The main branch is being refactored, use the stable one at [master](https://github.com/Renato66/auto-label/tree/master) subscribe to [v3](https://github.com/Renato66/auto-label/issues/75) to get the latest version when it's released | ||
## Creating | ||
|
||
Check out the app to make yml file | ||
[https://renato66.github.io/auto-label/](https://renato66.github.io/auto-label/) | ||
|
||
or | ||
|
||
add a file to `.github/workflows/issue.yml` | ||
|
||
```yml | ||
name: Labeling new issue | ||
on: | ||
issues: | ||
types: ['opened'] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: Renato66/auto-label@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
ignore-comments: true | ||
labels-synonyms: '{"bug":["error","need fix","not working"],"enhancement":["upgrade"],"question":["help"]}' | ||
labels-not-allowed: '["good first issue"]' | ||
default-labels: '["help wanted"]' | ||
``` | ||
## Inputs | ||
| Name | Description | Required | Default | Examples | | ||
| ------------------ | ----------------------------------- | -------- | ------- | :------------------------: | | ||
| repo-token | Github token for the repository | true | - | [...](#repo-token) | | ||
| ignore-comments | Ignore labels inside issue comments | false | true | [...](#ignore-comments) | | ||
| labels-synonyms | Text synonyms for labels | false | - | [...](#labels-synonyms) | | ||
| labels-not-allowed | Labels to ignore | false | - | [...](#labels-not-allowed) | | ||
| default-labels | Labels that will always be set | false | - | [...](#default-labels) | | ||
### Repo Token | ||
Repo token is provided automaticly by github just need to add | ||
``` | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
#### Change bot apperance | ||
If you want to change who added the labels, you can provide a user token | ||
![image](https://user-images.githubusercontent.com/9284273/79672221-678bf080-81a6-11ea-908e-fb875772121a.png) | ||
![image](https://user-images.githubusercontent.com/9284273/79672289-e123de80-81a6-11ea-9faa-237adc0873f0.png) | ||
The [token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) will only need the `public_repo` scope | ||
|
||
You will need to provide it as [secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) `GITHUB_USER_TOKEN` | ||
and update the issue.yml repo-token with: | ||
`repo-token: ${{ secrets.GITHUB_USER_TOKEN }}` | ||
|
||
### Ignore Comments | ||
|
||
If you prefer to leave as default (true) You can provide a list of labels in a [template](https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser) for the author to choose wich labels are avaliable to pick | ||
But if you prefer to set it as false, the author can set the labels inside a comment so it doesn't appear on issue body | ||
|
||
### Scoped blocks | ||
|
||
You can set a custom part of your issue/pr to be labeled using this structure: | ||
|
||
``` | ||
Some text that could have a label that wouldn't be set | ||
<!-- AUTO-LABEL:START --> | ||
Another text that could have a label and will be set as a label | ||
<!-- AUTO-LABEL:END --> | ||
``` | ||
|
||
thanks to [@dielduarte](https://github.com/dielduarte) and [@PauloGoncalvesBH](https://github.com/PauloGoncalvesBH) | ||
|
||
### Labels Synonyms | ||
|
||
Sometimes labels can be set uppon other texts, as an example, if you have a label like `C: VCombobox` it would be hard to match the label in a normal issue, but you can provide a JSON to set it synonyms: | ||
|
||
```bash | ||
bun install | ||
``` | ||
labels-synonyms: '{"C: VCombobox":["combobox","v-combobox","combo box"]}' | ||
``` | ||
|
||
### Labels Not Allowed | ||
|
||
To run: | ||
Some labels are restricted to repo owners such as `needs priority` `testing` `won't fix` they can be set in an Array form: | ||
|
||
```bash | ||
bun run index.ts | ||
``` | ||
labels-not-allowed: '["needs priority","testing","won't fix"]' | ||
``` | ||
|
||
This project was created using `bun init` in bun v1.1.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. | ||
### Default Labels | ||
|
||
Labels that will always be set when a issue is created/updated such as `triage`, they can be set in an Array form: | ||
|
||
``` | ||
default-labels: '["triage"]' | ||
``` | ||
|
||
## Badge | ||
|
||
To add a badge simple replace owner and repository | ||
|
||
<!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "Labeling%20new%20issue" --> | ||
|
||
[![Auto Label](https://github.com/Renato66/auto-label/workflows/Labeling%20new%20issue/badge.svg)](https://github.com/Renato66/auto-label) | ||
|
||
``` | ||
<!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "Labeling%20new%20issue" --> | ||
[![Auto Label](https://github.com/<OWNER>/<REPOSITORY>/workflows/Labeling%20new%20issue/badge.svg)](https://github.com/Renato66/auto-label) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import * as core from "@actions/core"; | ||
import * as core from '@actions/core' | ||
export const removeLabelsNotAllowed = (labels: string[]): string[] => { | ||
const labelsNotAllowed = core.getInput("labels-not-allowed"); | ||
const labelsNotAllowed = core.getInput('labels-not-allowed') | ||
if (!labelsNotAllowed) { | ||
return labels; | ||
return labels | ||
} | ||
const labelsToIgnore = JSON.parse(core.getInput("labels-not-allowed")); | ||
const labelsToIgnore = JSON.parse(core.getInput('labels-not-allowed')) | ||
return labels.filter((elem: string) => { | ||
return ( | ||
labelsToIgnore.find((label: string) => { | ||
return label.toLowerCase() === elem.toLowerCase(); | ||
return label.toLowerCase() === elem.toLowerCase() | ||
}) === undefined | ||
); | ||
}); | ||
}; | ||
) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters