From b7e10915e06988800aab3b42d0642f664fcc18fc Mon Sep 17 00:00:00 2001 From: Rohit Gohri Date: Fri, 6 Mar 2020 23:06:46 +0530 Subject: [PATCH] add doc for using personal token in github actions and update changelog --- CHANGELOG.md | 3 ++- source/ci_source/providers/GitHubActions.ts | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9c71d291..a624a0b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,9 @@ x +- Don't use hardcoded userId to update comments if using personal token in Github Actions - [@rohit-gohri] - Add the staged flag to `danger local` command - [@soyn] -- Disable warning in Github Action if using DANGER_GITHUB_API_TOKEN- [@rohit-gohri] +- Disable warning in Github Action if using DANGER_GITHUB_API_TOKEN - [@rohit-gohri] - Update `parse-diff` library - [@417-72KI] - Fix repository slug in Jenkins provider - [sandratatarevicova] - Fix Typos across danger-js Repo - [@yohix] diff --git a/source/ci_source/providers/GitHubActions.ts b/source/ci_source/providers/GitHubActions.ts index 5e0def95b..ded8e4b1c 100644 --- a/source/ci_source/providers/GitHubActions.ts +++ b/source/ci_source/providers/GitHubActions.ts @@ -132,7 +132,22 @@ import { readFileSync, existsSync } from "fs" * env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} * ``` * - * [GitHub automatically creates a `GITHUB_TOKEN` secret to use in your workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token). You can use the `GITHUB_TOKEN` to authenticate in a workflow run. + * [GitHub automatically creates a `GITHUB_TOKEN` secret to use in your workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token). + * You can use the `GITHUB_TOKEN` to authenticate in a workflow run. + * Using this token will post the danger comment as the `github-actions` app user. + * + * #### Using Personal Tokens + * + * If you need to post the danger comment as some particular user or for some other reason + * you need to use a personal token for danger then you can provide it in env as DANGER_GITHUB_API_TOKEN, + * but make sure that this is not the [automatically generated GITHUB_TOKEN in actions](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) + * otherwise comments will not be updated and new ones will be created everytime. + * + * ```yml + * - name: Danger JS + * uses: danger/danger-js@9.1.6 + * env: DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} + * ``` * */