Merge pull request #30 from robertdebock/patch-1

Set default values
This commit is contained in:
Alastair Mooney 2020-11-19 13:46:35 +00:00 committed by GitHub
commit 5133c21e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions

View File

@ -42,28 +42,21 @@ Latest version is `v2.2`.
- uses: "actions/checkout@master" - uses: "actions/checkout@master"
- name: "TODO to Issue" - name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@v2.2" uses: "alstr/todo-to-issue-action@v2.2"
with:
REPO: ${{ github.repository }}
BEFORE: ${{ github.event.before }}
SHA: ${{ github.sha }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABEL: "# TODO"
COMMENT_MARKER: "#"
id: "todo" id: "todo"
**If you use the action in a new repo, you should initialise the repo with an empty commit.** **If you use the action in a new repo, you should initialise the repo with an empty commit.**
### Inputs ### Inputs
| Input | Description | | Input | Default value | Description |
|----------|-------------| |----------|---------------|-------------|
| `REPO` | The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set) | | `REPO` | "${{ github.repository }}" | The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set) |
| `BEFORE` | The SHA of the last pushed commit (automatically set) | | `BEFORE` | "${{ github.event.before }}" | The SHA of the last pushed commit (automatically set) |
| `SHA` | The SHA of the latest commit (automatically set) | | `SHA` | "${{ github.sha }}" | The SHA of the latest commit (automatically set) |
| `TOKEN` | The GitHub access token to allow us to retrieve, create and update issues (automatically set) | | `TOKEN` | "${{ secrets.GITHUB_TOKEN }}" | The GitHub access token to allow us to retrieve, create and update issues (automatically set) |
| `LABEL` | The label that will be used to identify TODO comments (e.g. `# TODO` for Python) | | `LABEL` | "# TODO" | The label that will be used to identify TODO comments (e.g. `# TODO` for Python) |
| `COMMENT_MARKER` | The marker used to signify a line comment in your code (e.g. `#` for Python) | | `COMMENT_MARKER` | "#" | The marker used to signify a line comment in your code (e.g. `#` for Python) |
| `CLOSE_ISSUES` | Optional input that specifies whether to attempt to close an issue when a TODO is removed (default: "true") | | `CLOSE_ISSUES` | "true" | Optional input that specifies whether to attempt to close an issue when a TODO is removed |
## Examples ## Examples

View File

@ -11,21 +11,28 @@ inputs:
REPO: REPO:
description: "The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set)" description: "The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set)"
required: true required: true
default: "${{ github.repository }}"
BEFORE: BEFORE:
description: "The SHA of the last pushed commit (automatically set)" description: "The SHA of the last pushed commit (automatically set)"
required: true required: true
default: "${{ github.event.before }}"
SHA: SHA:
description: "The SHA of the latest commit (automatically set)" description: "The SHA of the latest commit (automatically set)"
required: true required: true
default: "${{ github.sha }}"
TOKEN: TOKEN:
description: "The GitHub access token to allow us to retrieve, create and update issues (automatically set)" description: "The GitHub access token to allow us to retrieve, create and update issues (automatically set)"
required: true required: true
default: "${{ secrets.GITHUB_TOKEN }}"
LABEL: LABEL:
description: "The label that will be used to identify TODO comments (e.g. # TODO for Python)" description: "The label that will be used to identify TODO comments (e.g. # TODO for Python)"
required: true required: true
default: "# TODO"
COMMENT_MARKER: COMMENT_MARKER:
description: "The marker used to signify a line comment in your code (e.g. # for Python)" description: "The marker used to signify a line comment in your code (e.g. # for Python)"
required: true required: true
default: "#"
CLOSE_ISSUES: CLOSE_ISSUES:
description: "Optional input that specifies whether to attempt to close an issue when a TODO is removed (default: true)" description: "Optional input that specifies whether to attempt to close an issue when a TODO is removed (default: true)"
required: false required: false
default: "true"

View File

@ -20,7 +20,7 @@ def main():
comment_marker = os.getenv('INPUT_COMMENT_MARKER') comment_marker = os.getenv('INPUT_COMMENT_MARKER')
label = os.getenv('INPUT_LABEL') label = os.getenv('INPUT_LABEL')
token = os.getenv('INPUT_TOKEN') token = os.getenv('INPUT_TOKEN')
close_issues = os.getenv('INPUT_CLOSE_ISSUES', 'true') == 'true' close_issues = os.getenv('INPUT_CLOSE_ISSUES')
# Load a file so we can see what language each file is written in and apply highlighting later. # Load a file so we can see what language each file is written in and apply highlighting later.
languages_url = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml' languages_url = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml'