Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: read default token #67

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,35 @@ critical:

Create a workflow (eg: `.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:

```
```yml
name: "Issue Labeler"
on:
issues:
types: [opened, edited]

permissions:
issues: write

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v2.5 #May not be the latest version
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
not-before: 2020-01-15T02:54:32Z
enable-versioned-regex: 0
```

`not-before` is optional and will result in any issues prior to this timestamp to be ignored.

_Note: The above workflow grants access to the `GITHUB_TOKEN` so the action can make calls to GitHub's REST API._


### Example using versioned issue templates

As you iterate on your regular expressions, since maybe your issue template gets updated, this can have an impact on existing issues. The below allows you to version your regular expression definitions and pair them with issue templates.

Below is the body of an example issue which has the version identifier `issue_labeler_regex_version` embedded.

```
```md
<!--
issue_labeler_regex_version=1
--!>
Expand All @@ -69,19 +68,21 @@ I have an urgent issue that requires someone's attention.

Below is the workflow file

```
```yml
name: "Issue Labeler"
on:
issues:
types: [opened, edited]

permissions:
issues: write

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v2.5 #May not be the latest version
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
not-before: 2020-01-15T02:54:32Z
enable-versioned-regex: 1
Expand All @@ -101,7 +102,7 @@ Set `body-missing-regex-label` to the name of the label that should be added to

The labeler action is also available for pull requests. Make sure the workflow is triggered by pull requests.

```
```yml
on:
pull_request:
types: [opened, edited]
Expand All @@ -111,19 +112,21 @@ on:

Set `include-title` to `1` to include the issue title in addition to the body in the regular expression target.

```
```yml
name: "Issue Labeler"
on:
issues:
types: [opened, edited]

permissions:
issues: write

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v2.5 #May not be the latest version
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
include-title: 1
Expand All @@ -134,14 +137,13 @@ jobs:
By default, labels that no longer match are not removed from the issue. To enable this functionality, explicity
set `sync-labels` to `1`.

```
```yml
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: github/issue-labeler@v2.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
sync-labels: 1
Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ author: 'GitHub'
inputs:
repo-token:
description: 'The GITHUB_TOKEN secret'
required: true
required: false
default: '${{ github.token }}'
configuration-path:
description: 'Path to the labeler.yml configuration file'
required: true
Expand Down