Skip to content

Commit

Permalink
feat: document the use of personal access tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
dessant committed Jul 4, 2021
1 parent a5bc082 commit 6ba0377
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
48 changes: 37 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Support Requests is a GitHub Action that comments on
and closes issues labeled as support requests.

> The legacy version of this project can be found
[here](https://github.com/dessant/support-requests-app).
> [here](https://github.com/dessant/support-requests-app).
![](assets/screenshot.png)

Expand All @@ -19,12 +19,14 @@ please consider contributing with

## Description

Support Requests can perform the following actions when an issue
Support Requests is a specialized version of
[Label Actions](https://github.com/dessant/label-actions),
and it can perform the following actions when an issue
is labeled, unlabeled or reopened:

* The support label is added: leave a comment, close and lock the issue
* The support label is removed: reopen and unlock the issue
* The issue is reopened: remove the support label, unlock the issue
- The support label is added: leave a comment, close and lock the issue
- The support label is removed: reopen and unlock the issue
- The issue is reopened: remove the support label, unlock the issue

## Usage

Expand All @@ -33,11 +35,12 @@ use one of the [example workflows](#examples) to get started.

### Inputs

The action can be configured using [input parameters](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith).
All parameters are optional, except `github-token`.
The action can be configured using [input parameters](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith).

<!-- prettier-ignore -->
- **`github-token`**
- GitHub access token, value must be `${{ github.token }}`
- GitHub access token, value must be `${{ github.token }}` or an encrypted
secret that contains a [personal access token](#using-a-personal-access-token)
- Optional, defaults to `${{ github.token }}`
- **`support-label`**
- Label used to mark issues as support requests
Expand Down Expand Up @@ -67,6 +70,7 @@ All parameters are optional, except `github-token`.
The following workflow will comment on and close issues
marked as support requests.

<!-- prettier-ignore -->
```yaml
name: 'Support requests'

Expand All @@ -75,7 +79,7 @@ on:
types: [labeled, unlabeled, reopened]

jobs:
support:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/support-requests@v2
Expand All @@ -84,8 +88,9 @@ jobs:
### Available input parameters

This workflow declares all the available input parameters of the action
and their default values. All parameters can be omitted, except `github-token`.
and their default values. Any of the parameters can be omitted.

<!-- prettier-ignore -->
```yaml
name: 'Support requests'

Expand All @@ -94,11 +99,12 @@ on:
types: [labeled, unlabeled, reopened]

jobs:
support:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/support-requests@v2
with:
github-token: ${{ github.token }}
support-label: 'support'
issue-comment: >
:wave: @{issue-author}, we use the issue tracker exclusively
Expand All @@ -110,6 +116,26 @@ jobs:
issue-lock-reason: 'off-topic'
```

### Using a personal access token

The action uses an installation access token by default to interact with GitHub.
You may also authenticate with a personal access token to perform actions
as a GitHub user instead of the `github-actions` app.

Create a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
with the `repo` or `public_repo` scopes enabled, and add the token as an
[encrypted secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)
for the repository or organization, then provide the action with the secret
using the `github-token` input parameter.

<!-- prettier-ignore -->
```yaml
steps:
- uses: dessant/label-actions@v2
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
```

## License

Copyright (c) 2017-2021 Armin Sebastian
Expand Down
3 changes: 1 addition & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ author: 'Armin Sebastian'
inputs:
github-token:
description: 'GitHub access token'
required: false
default: ${{ github.token }}
default: '${{ github.token }}'
support-label:
description: 'Label used to mark issues as support requests'
default: 'support'
Expand Down

0 comments on commit 6ba0377

Please sign in to comment.