mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 20:24:51 +00:00
Compare commits
34 Commits
v5
...
plugin-ret
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85d7ddfabf | ||
|
|
2755f92612 | ||
|
|
31efb45c79 | ||
|
|
deb1c03ec1 | ||
|
|
a261db4c87 | ||
|
|
5838aad63e | ||
|
|
98d12e7f87 | ||
|
|
857d8ca96a | ||
|
|
bb8f002e4f | ||
|
|
70db055cd5 | ||
|
|
2e99c4dc10 | ||
|
|
506e1a00c6 | ||
|
|
83720bce86 | ||
|
|
e5bd067930 | ||
|
|
b2b2c20d44 | ||
|
|
02180c4758 | ||
|
|
17086b7743 | ||
|
|
5e969e09f0 | ||
|
|
035de5e30d | ||
|
|
73e8e27589 | ||
|
|
ccee68d6cf | ||
|
|
2b7003274c | ||
|
|
90cc4c2623 | ||
|
|
4a56a41318 | ||
|
|
aa18a3cacc | ||
|
|
dea3f9b186 | ||
|
|
0ad0ff974e | ||
|
|
4b5201e562 | ||
|
|
ccaeba86e2 | ||
|
|
08bb101f04 | ||
|
|
f9ea084de7 | ||
|
|
587debe10c | ||
|
|
92c8874170 | ||
|
|
c3a152eec1 |
20
.github/workflows/publish-immutable-actions.yml
vendored
Normal file
20
.github/workflows/publish-immutable-actions.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@0.0.3
|
||||
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
version: 1.10.1
|
||||
version: 1.11.1
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||
|
||||
20
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
20
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@actions/exec"
|
||||
version: 1.1.1
|
||||
type: npm
|
||||
summary: Actions exec lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |-
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
||||
notices: []
|
||||
20
.licenses/npm/@actions/io.dep.yml
generated
Normal file
20
.licenses/npm/@actions/io.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@actions/io"
|
||||
version: 1.1.3
|
||||
type: npm
|
||||
summary: Actions io lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/io
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |-
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
||||
notices: []
|
||||
2
.licenses/npm/minimatch.dep.yml
generated
2
.licenses/npm/minimatch.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: minimatch
|
||||
version: 9.0.3
|
||||
version: 10.0.1
|
||||
type: npm
|
||||
summary: a glob matcher in javascript
|
||||
homepage:
|
||||
|
||||
2
.licenses/npm/undici.dep.yml
generated
2
.licenses/npm/undici.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: undici
|
||||
version: 5.26.5
|
||||
version: 5.28.4
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
|
||||
41
README.md
41
README.md
@@ -13,6 +13,9 @@ Automatically label new pull requests based on the paths of files being changed
|
||||
|
||||
4) Version 5 of this action updated the [runtime to Node.js 20](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions). All scripts are now run with Node.js 20 instead of Node.js 16 and are affected by any breaking changes between Node.js 16 and 20.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Before the update to the v5, please check out [this information](#notes-regarding-pull_request_target-event) about the `pull_request_target` event trigger.
|
||||
|
||||
## Usage
|
||||
|
||||
### Create `.github/labeler.yml`
|
||||
@@ -110,6 +113,18 @@ Documentation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: docs/*
|
||||
|
||||
# Add 'Documentation' label to any file changes within 'docs' or 'guides' folders
|
||||
Documentation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- docs/*
|
||||
- guides/*
|
||||
|
||||
## Equivalent of the above mentioned configuration using another syntax
|
||||
Documentation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: ['docs/*', 'guides/*']
|
||||
|
||||
# Add 'Documentation' label to any change to .md files within the entire repository
|
||||
Documentation:
|
||||
- changed-files:
|
||||
@@ -126,14 +141,14 @@ source:
|
||||
feature:
|
||||
- head-branch: ['^feature', 'feature']
|
||||
|
||||
# Add 'release' label to any PR that is opened against the `main` branch
|
||||
# Add 'release' label to any PR that is opened against the `main` branch
|
||||
release:
|
||||
- base-branch: 'main'
|
||||
```
|
||||
|
||||
### Create Workflow
|
||||
|
||||
Create a workflow (e.g. `.github/workflows/labeler.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)) to utilize the labeler action with content:
|
||||
Create a workflow (e.g. `.github/workflows/labeler.yml` see [Creating a Workflow file](https://docs.github.com/en/actions/writing-workflows/quickstart#creating-your-first-workflow)) to utilize the labeler action with content:
|
||||
|
||||
```yml
|
||||
name: "Pull Request Labeler"
|
||||
@@ -246,6 +261,28 @@ jobs:
|
||||
In order to add labels to pull requests, the GitHub labeler action requires write permissions on the pull-request. However, when the action runs on a pull request from a forked repository, GitHub only grants read access tokens for `pull_request` events, at most. If you encounter an `Error: HttpError: Resource not accessible by integration`, it's likely due to these permission constraints. To resolve this issue, you can modify the `on:` section of your workflow to use
|
||||
[`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) instead of `pull_request` (see example [above](#create-workflow)). This change allows the action to have write access, because `pull_request_target` alters the [context of the action](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) and safely grants additional permissions. Refer to the [GitHub token permissions documentation](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) for more details about access levels and event contexts.
|
||||
|
||||
## Notes regarding `pull_request_target` event
|
||||
|
||||
Using the `pull_request_target` event trigger involves several peculiarities related to initial set up of the labeler or updating version of the labeler.
|
||||
|
||||
### Initial set up of the labeler action
|
||||
|
||||
When submitting an initial pull request to a repository using the `pull_request_target` event, the labeler workflow will not run on that pull request because the `pull_request_target` execution runs off the base branch instead of the pull request's branch. Unfortunately this means the introduction of the labeler can not be verified during that pull request and it needs to be committed blindly.
|
||||
|
||||
### Updating major version of the labeler
|
||||
|
||||
When submitting a pull request that includes updates of the labeler action version and associated configuration files, using the `pull_request_target` event may result in a failed workflow. This is due to the nature of `pull_request_target`, which uses the code from the base branch rather than the branch linked to the pull request — so, potentially outdated configuration files may not be compatible with the updated labeler action.
|
||||
|
||||
To prevent this issue, you can switch to using the `pull_request` event temporarily, before merging. This event execution draws from the code within the branch of your pull request, allowing you to verify the new configuration's compatibility with the updated labeler action.
|
||||
|
||||
```yml
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request
|
||||
```
|
||||
|
||||
Once you confirm that the updated configuration files function as intended, you can then revert to using the `pull_request_target` event before merging the pull request. Following this step ensures that your workflow is robust and free from disruptions.
|
||||
|
||||
## Contributions
|
||||
|
||||
Contributions are welcome! See the [Contributor's Guide](CONTRIBUTING.md).
|
||||
|
||||
3795
dist/index.js
vendored
3795
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
783
package-lock.json
generated
783
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -24,29 +24,30 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@octokit/plugin-retry": "^6.0.0",
|
||||
"@octokit/plugin-retry": "^7.1.2",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"minimatch": "^9.0.3"
|
||||
"minimatch": "^10.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.6",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/lodash.isequal": "^4.5.6",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/lodash.isequal": "^4.5.8",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/node": "^20.8.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||
"@typescript-eslint/parser": "^6.7.2",
|
||||
"@types/node": "^20.11.30",
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-jest": "^27.4.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-jest": "^27.9.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"prettier": "^3.0.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.2"
|
||||
"prettier": "^3.4.2",
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.7.2"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user