Skip to content

Commit

Permalink
Use token from github context
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Aug 12, 2021
1 parent 74f6053 commit 10b7645
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ jobs:
- uses: ./
with:
extensions: 'js,ts'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ jobs:
- run: npm ci # or yarn install
- uses: sibiraj-s/action-eslint@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Optional
eslintArgs: '--ignore-path=.gitignore --quiet'
extensions: 'js,jsx,ts,tsx'
annotations: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## Security
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ runs:
main: 'dist/index.js'

inputs:
github-token:
description: The GitHub token used to create an authenticated client
required: false
default: ${{ github.token }}
eslintArgs:
description: 'ESLint CLI flags'
required: false
Expand Down
5 changes: 1 addition & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import getChangedFiles from './getChangedFiles';

const run = async () => {
try {
const token = process.env.GITHUB_TOKEN;

if (!token) {
return setFailed('GITHUB_TOKEN not found in environment variables.');
}
const token = getInput('github-token', { required: true });

const enableAnnotations = getBooleanInput('annotations');
if (!enableAnnotations) {
Expand Down

0 comments on commit 10b7645

Please sign in to comment.