Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Decathlon/pull-request-labeler-action
:zap: Github action to label your pull requests auto-magically :sparkles:(using committed files)
https://github.com/Decathlon/pull-request-labeler-action
github-actions labels project-management projects typescript
Last synced: 6 days ago
JSON representation
:zap: Github action to label your pull requests auto-magically :sparkles:(using committed files)
- Host: GitHub
- URL: https://github.com/Decathlon/pull-request-labeler-action
- Owner: Decathlon
- License: apache-2.0
- Archived: true
- Created: 2019-06-20T13:57:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-15T07:28:24.000Z (over 1 year ago)
- Last Synced: 2024-08-02T07:10:38.104Z (3 months ago)
- Topics: github-actions, labels, project-management, projects, typescript
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/pr-label-by-files
- Size: 431 KB
- Stars: 95
- Watchers: 3
- Forks: 16
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-actions - Label your Pull Requests auto-magically (using committed files)
- fucking-awesome-actions - Label your Pull Requests auto-magically (using committed files)
- awesome-workflows - Label your Pull Requests auto-magically (using committed files)
README
# THIS ACTION IS DEPRECATED AND ARCHIVED.
# You should not use it anymore, A better alternative is https://github.com/actions/labeler## DEPRECATED, do not use anymore
### Readme kept as archive
---
This repository provides a GitHub action to automatically label a pull request based on committed files.**Table of Contents**
- [Common usage](#common-usage)
- [Breaking change](#breaking-change)
- [Startup](#startup)
- [Configuration](#configuration)
- [Use GitHub action](#use-github-action)
- [Settings for v1.0.0+ release (deprecated)](#settings-for-v100-release-deprecated)
- [Settings for v2.0.0+ release](#settings-for-v200-release)
- [Contributing](#contributing)
- [Commands](#commands)
- [License](#license)## Common usage
When pushing, the action will be triggered and will look for committed files over your branch.
It applies configured labels whenever it find a file whose name matches the associated regular expression.
## Breaking change
Starting from August 2019, GitHub switch [Actions syntax from HCL to YAML](https://help.github.com/en/articles/migrating-github-actions-from-hcl-syntax-to-yaml-syntax).
The previous syntax will no longer be supported by GitHub on September 30, 2019.As a consequence, __please use v2.0.0+__ release and note that __all v1.x.x are deprecated__ and will no longer work on September 30, 2019.
## Startup
### Configuration
Create a file into your root project directory: `.github/label-pr.yml`:
```yaml
- regExp: ".*\\.ts+$"
labels: ["typescript"]
- regExp: ".*\\.sql+$"
labels: ["database", "critical"]
- regExp: ".*\\.md+$"
labels: ["documentation"]
- regExp: "^(pom\\.xml|package\\.json|build\\.gradle)$"
labels: ["dependencies"]
- regExp: ".*\\.(zip|jar|war|ear)+$"
labels: ["artifact", "invalid"]
```
_This is a sample to illustrate how you can customize your settings by configuring your own regex and labels_The configuration is made of a list of `Filter` which are composed of:
- `regExp`: a regular expression which will be tested over the filenames
- `labels`: a list of labels to apply if the filenames matchIf the labels do not exist yet in your repository configuration, they will be created anyway.
### Use GitHub action
#### Settings for v1.0.0+ release (deprecated)
Create a file into your root project directory (if it does not exist yet): `.github/main.workflow`:
```
workflow "New workflow" {
resolves = ["PR label by Files"]
on = "pull_request"
}action "PR label by Files" {
uses = "decathlon/[email protected]"
secrets = ["GITHUB_TOKEN"]
}
```#### Settings for v2.0.0+ release
Create a file into your root project directory: `.github/workflows/labeler.yml`:
```yaml
# Workflow to associate labels automatically
name: labeler
# Trigger the workflow on pull request events
on: [pull_request]
jobs:
label:
runs-on: ubuntu-18.04
steps:
# We need to checkout the repository to access the configured file (.github/label-pr.yml)
- uses: actions/checkout@v2
- name: Labeler
uses: docker://decathlon/pull-request-labeler-action:2.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Here we can override the path for the action configuration. If none is provided, default one is `.github/label-pr.yml`
CONFIG_PATH: ${{ secrets.GITHUB_WORKSPACE }}/.github/label-pr.yml
```_Please note that you can move the label-pr.yml to another location, if so, then do not forget to update the above **CONFIG_PATH**_ variable.
## Contributing
- The project is built using [Typescript](https://www.typescriptlang.org/) # `3.5.2`
- We use a [tslint](https://palantir.github.io/tslint/) as a linter for defining code style which configuration may change
- We use [Jest](https://jestjs.io/) as the testing frameworkTo start, you just need to clone the repository and open it in your favorite IDE.
You may need to set it up so it uses the node configuration (`package.json`) and tslint configuration (`tslint.json`).### Commands
- To run unit tests: `npm run test:watch`
- To build: `npm run build:main`