Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 787406b

Browse filesBrowse files
authored
Merge pull request #152 from actions/joshmgross/add-instructions-for-pat
Add instructions for using a separate GitHub token
2 parents c32ce14 + bfb7c23 commit 787406b
Copy full SHA for 787406b

File tree

Expand file treeCollapse file tree

1 file changed

+29
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+29
-0
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+29Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,32 @@ jobs:
350350
351351
console.log(`Hello ${FIRST_NAME} ${LAST_NAME}`)
352352
```
353+
354+
### Using a separate GitHub token
355+
356+
The `GITHUB_TOKEN` used by default is scoped to the current repository, see [Authentication in a workflow](https://docs.github.com/actions/reference/authentication-in-a-workflow).
357+
358+
If you need access to a different repository or an API that the `GITHUB_TOKEN` doesn't have permissions to, you can provide your own [PAT](https://help.github.com/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) as a secret using the `github-token` input.
359+
360+
[Learn more about creating and using encrypted secrets](https://docs.github.com/actions/reference/encrypted-secrets)
361+
362+
```yaml
363+
on:
364+
issues:
365+
types: [opened]
366+
367+
jobs:
368+
apply-label:
369+
runs-on: ubuntu-latest
370+
steps:
371+
- uses: actions/github-script@v4
372+
with:
373+
github-token: ${{ secrets.MY_PAT }}
374+
script: |
375+
github.issues.addLabels({
376+
issue_number: context.issue.number,
377+
owner: context.repo.owner,
378+
repo: context.repo.repo,
379+
labels: ['Triage']
380+
})
381+
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.