mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 03:58:05 +00:00
b726232fd7c0adf199970d2c74148c09e00c1de4
* Fetch configuration content from PR ref Fixes #6 When fetching the configuration content from the file specified by `configuration-path`, we should load the content from the ref of the PR. By default, `repos.getContents` will [use the repository's default branch][1] if no `ref` is specified. When first configuring this action, assuming the configuration file is added in the same PR as the action, the configuration file will not exist on the default branch. This causes an `HttpError: Not Found` to occur when attempting to load the configuration from the default branch. This commit updates the call to `getContents` to add the `ref` parameter, set to the `GITHUB_SHA` value from the context. This will cause the action to load the contents of the configuration file from the ref of the PR, rather than the default branch. --- This PR also updates the packages to use version 1.0.0 of all the toolkit action packages, as they were using local files before. I noticed that `src/main.ts` is not formatted according to the prettier rules. I'm happy to open another PR that applies prettier to the current source. I had to disable prettier during implementation of this commit in order to keep the changes relevant to this PR. [1]: https://developer.github.com/v3/repos/contents/#get-contents * Remove exec, io, tool-cache
Pull Request Labeler
Pull request labeler triages PRs based on the paths that are modified in the PR.
To use, create a .github/labeler.yml file with a list of labels and minimatch
globs to match to apply the label.
Example:
label1:
- example1/**/*
label2: example2/*
label3:
- example3/*
- example3/**/*.yml
Then create a workflow:
name: "Pull Request Labeler"
on:
- pull-request
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Languages
TypeScript
99.7%
JavaScript
0.3%