You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
143
143
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit)
144
144
- [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event)
145
145
- [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token)
146
+
- [Push a commit to a PR using the built-in token](#Push-a-commit-to-a-PR-using-the-built-in-token)
146
147
147
148
## Fetch only the root files
148
149
@@ -288,6 +289,31 @@ jobs:
288
289
```
289
290
*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
290
291
292
+
## Push a commit to a PR using the built-in token
293
+
294
+
In a pull request trigger, `ref` is required as GitHub Actions checks out in detached HEAD mode, meaning it doesn’t check out your branch by default.
295
+
296
+
```yaml
297
+
on: pull_request
298
+
jobs:
299
+
build:
300
+
runs-on: ubuntu-latest
301
+
steps:
302
+
- uses: actions/checkout@v4
303
+
with:
304
+
ref: ${{ github.head_ref }}
305
+
- run: |
306
+
date > generated.txt
307
+
# Note: the following account information will not work on GHES
*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
315
+
316
+
291
317
# License
292
318
293
319
The scripts and documentation in this project are released under the [MIT License](LICENSE)
0 commit comments