From 6ba0377537d5719b6b907feabd5e5e3057321cee Mon Sep 17 00:00:00 2001 From: dessant Date: Sun, 4 Jul 2021 14:06:48 +0300 Subject: [PATCH] feat: document the use of personal access tokens --- README.md | 48 +++++++++++++++++++++++++++++++++++++----------- action.yml | 3 +-- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 27b34b4..2f6b713 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 @@ -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). + - **`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 @@ -67,6 +70,7 @@ All parameters are optional, except `github-token`. The following workflow will comment on and close issues marked as support requests. + ```yaml name: 'Support requests' @@ -75,7 +79,7 @@ on: types: [labeled, unlabeled, reopened] jobs: - support: + action: runs-on: ubuntu-latest steps: - uses: dessant/support-requests@v2 @@ -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. + ```yaml name: 'Support requests' @@ -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 @@ -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. + + +```yaml + steps: + - uses: dessant/label-actions@v2 + with: + github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} +``` + ## License Copyright (c) 2017-2021 Armin Sebastian diff --git a/action.yml b/action.yml index 2f5fed0..26fb480 100644 --- a/action.yml +++ b/action.yml @@ -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'