Compare commits

...

3 Commits

Author SHA1 Message Date
Samuel Lijin
bae39240ba
Merge 38cc68387c3b860d300c418c96d22b847a064a94 into 3b9b8c884f6b4bb4d5be2779c26374abadae0871 2024-11-11 09:36:01 +01:00
The web walker
3b9b8c884f
docs: update README.md (#1971)
Some checks failed
CodeQL / Analyze (javascript) (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
Add a scenario where it is necessary to push a commit to a pull request.
2024-11-08 10:32:54 -05:00
Samuel Lijin
38cc68387c
fix(lfs): ensure that LFS objects are checked out 2023-06-27 16:36:44 -07:00
3 changed files with 36 additions and 0 deletions

View File

@ -143,6 +143,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit)
- [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event)
- [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token)
- [Push a commit to a PR using the built-in token](#Push-a-commit-to-a-PR-using-the-built-in-token)
## Fetch only the root files
@ -288,6 +289,31 @@ jobs:
```
*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
## Push a commit to a PR using the built-in token
In a pull request trigger, `ref` is required as GitHub Actions checks out in detached HEAD mode, meaning it doesnt check out your branch by default.
```yaml
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- run: |
date > generated.txt
# Note: the following account information will not work on GHES
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
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
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)

View File

@ -44,6 +44,7 @@ export interface IGitCommandManager {
getWorkingDirectory(): string
init(): Promise<void>
isDetached(): Promise<boolean>
lfsCheckout(): Promise<void>
lfsFetch(ref: string): Promise<void>
lfsInstall(): Promise<void>
log1(format?: string): Promise<string>
@ -340,6 +341,10 @@ class GitCommandManager {
return !output.stdout.trim().startsWith('refs/heads/')
}
async lfsCheckout(): Promise<void> {
await this.execGit(['lfs', 'checkout'])
}
async lfsFetch(ref: string): Promise<void> {
const args = ['lfs', 'fetch', 'origin', ref]

View File

@ -232,6 +232,11 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint)
core.endGroup()
// LFS checkout
core.startGroup('Checking out LFS objects')
await git.lfsCheckout()
core.endGroup()
// Submodules
if (settings.submodules) {
// Temporarily override global config