[READ-ONLY] Mirror of https://github.com/probablykasper/readme-template-action. Integrate GitHub API data in your README.md
0

Configure Feed

Select the types of activity you want to include in your feed.

Renamed warning from last commit, renamed GITHUB_TOKEN to TOKEN

The issue I was having was that I was passing GITHUB_TOKEN, which is a built in thing that you can't override

Kasper (Aug 23, 2020, 9:49 PM +0200) dc722c02 92abaaf9

+7 -10
+3 -3
README.md
··· 10 10 11 11 | name | type | default | description | 12 12 | ------------ | ------ | --------------- | ----------- | 13 - | github_token | string | | GitHub personal access token used to fetch data. Can be passed using `${{ secrets.GITHUB_TOKEN }}`. [Go here](https://github.com/settings/tokens/new?scopes=read:user) to generate one with the `read:user` scope 13 + | token | string | | GitHub personal access token used to fetch data. Pass a secret by for instance using `${{ secrets.README_TEMPLATE_TOKEN }}`. [Go here](https://github.com/settings/tokens/new?scopes=read:user) to generate one with the `read:user` scope 14 14 | template | string | `"TEMPLATE.md"` | Template file path 15 15 | readme | string | `"README.md"` | Output file path 16 16 ··· 37 37 - name: Generate README.md 38 38 uses: probablykasper/readme-template-action@v1 39 39 with: 40 - github_token: ${{ secrets.GITHUB_TOKEN }} 40 + token: ${{ secrets.README_TEMPLATE_TOKEN }} 41 41 template: TEMPLATE.md 42 42 output: README.md 43 43 - name: Update README.md ··· 271 271 4. Create a `.env` file like this, with your token: 272 272 273 273 ```env 274 - INPUT_GITHUB_TOKEN=mytoken 274 + INPUT_TOKEN=mytoken 275 275 INPUT_TEMPLATE=EXAMPLE_TEMPLATE.md 276 276 INPUT_OUTPUT=EXAMPLE_OUTPUT.md 277 277 ```
+1 -1
action.yml
··· 2 2 author: Kasper Henningsen 3 3 description: Insert variables into markdown file using a template file 4 4 inputs: 5 - github_token: 5 + token: 6 6 description: Your github personal access token with `read:user` scope 7 7 required: true 8 8 template:
+1 -1
dist/index.js
··· 4772 4772 const github = __webpack_require__(438) 4773 4773 const moment = __webpack_require__(623) 4774 4774 4775 - const ghToken = core.getInput('GITHUB_TOKEN', { required: true }) 4775 + const ghToken = core.getInput('TOKEN', { required: true }) 4776 4776 core.setSecret(ghToken) 4777 4777 const octokit = github.getOctokit(ghToken) 4778 4778 module.exports.octokit = octokit
+1 -1
package.json
··· 2 2 "name": "readme-template", 3 3 "scripts": { 4 4 "build": "ncc build src/main.js -o dist", 5 - "test": "ncc build src/main.js -o dist && export $(cat .env | xargs) && node dist/bundle.js" 5 + "test": "ncc build src/main.js -o dist && export $(cat .env | xargs) && node dist/index.js" 6 6 }, 7 7 "dependencies": { 8 8 "@actions/core": "^1.2.4",
-3
src/main.js
··· 84 84 const user = await queries.getUser() 85 85 console.log(' - Injecting') 86 86 outputStr = inject(outputStr, user) 87 - if (user.USERNAME === 'github-actions[bot]') { 88 - console.log('Warning: The username is "github-actions[bot]". You may have forgotten to add your github token secret') 89 - } 90 87 91 88 if (!customTemplate['3_MOST_STARRED_REPOS']) { 92 89 customTemplate['3_MOST_STARRED_REPOS'] = {
+1 -1
src/queries.js
··· 2 2 const github = require('@actions/github') 3 3 const moment = require('moment') 4 4 5 - const ghToken = core.getInput('GITHUB_TOKEN', { required: true }) 5 + const ghToken = core.getInput('TOKEN', { required: true }) 6 6 core.setSecret(ghToken) 7 7 const octokit = github.getOctokit(ghToken) 8 8 module.exports.octokit = octokit