Compare commits

...

4 commits

Author SHA1 Message Date
Ariel Elkin
335e98a846
Merge d03156b5b8 into 85e6279cec 2025-01-16 13:06:16 -08:00
Josh Gross
85e6279cec
Adjust positioning of user email note and permissions heading (#2044)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Licensed / Check licenses (push) Has been cancelled
Build and Test / build (push) Has been cancelled
Build and Test / test (macos-latest) (push) Has been cancelled
Build and Test / test (ubuntu-latest) (push) Has been cancelled
Build and Test / test (windows-latest) (push) Has been cancelled
Build and Test / test-proxy (push) Has been cancelled
Build and Test / test-bypass-proxy (push) Has been cancelled
Build and Test / test-git-container (push) Has been cancelled
Build and Test / test-output (push) Has been cancelled
2025-01-16 15:56:18 -05:00
Ben Wells
009b9ae9e4
Documentation update - add recommended permissions to Readme (#2043)
* Update README.md

* Update README.md

Co-authored-by: Josh Gross <joshmgross@github.com>

---------

Co-authored-by: Josh Gross <joshmgross@github.com>
2025-01-16 14:14:48 -05:00
Ariel Elkin
d03156b5b8
Update README.md 2021-12-15 10:17:09 +00:00

View file

@ -33,6 +33,9 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
# with the local git config, which enables your scripts to run authenticated git
# commands. The post-job step removes the PAT.
#
# If any of the submodules are private GitHub repos, pass in a PAT with read-access
# to them.
#
# We recommend using a service account with the least permissions necessary. Also
# when generating a new PAT, select the least scopes necessary.
#
@ -110,8 +113,8 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
#
# When the `ssh-key` input is not provided, SSH URLs beginning with
# `git@github.com:` are converted to HTTPS.
# When neither the `ssh-key` nor the `token` inputs are provided, SSH URLs
# beginning with `git@github.com:` are converted to HTTPS.
#
# Default: false
submodules: ''
@ -240,12 +243,19 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
uses: actions/checkout@v4
with:
repository: my-org/my-private-tools
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains a PAT with read-access to this private repository
path: my-tools
```
> - `${{ github.token }}` is scoped to the current repository, so if you want to checkout a different repository that is private you will need to provide your own [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
## Checkout a repo and its private submodules
```yaml
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains a PAT with read-access to the private submodules
```
## Checkout pull request HEAD commit instead of merge commit
@ -311,8 +321,17 @@ jobs:
git commit -m "generated"
git push
```
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
# Recommended permissions
When using the `checkout` action in your GitHub Actions workflow, it is recommended to set the following `GITHUB_TOKEN` permissions to ensure proper functionality, unless alternative auth is provided via the `token` or `ssh-key` inputs:
```yaml
permissions:
contents: read
```
# License