Skip to content

Commit

Permalink
Try cloning without actions/checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
lerebear committed Dec 31, 2023
1 parent 2747dbb commit a7d52be
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 54 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ jobs:
runs-on: ubuntu-latest

steps:
# Perform a minimal checkout to set up this repository for the rest of the
# workflow.
#
# This step must be configured exactly as below: using different
# actions/checkout arguments is not supported.
- name: Checkout this repository
uses: actions/checkout@v4
with:
filter: tree:0

# Run the estimation tool
- name: Run sizeup
# TODO: Replace the version below with your desired version.
uses: lerebear/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 9 additions & 19 deletions dist/index.js

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

34 changes: 11 additions & 23 deletions src/initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,20 @@ export async function fetchDiff(
): Promise<string | undefined> {
const git = simpleGit('.', { trimmed: true })

// let baseRefExists = false
// try {
// baseRefExists = !!(await git.raw('rev-parse', '--verify', pull.base.ref))
// } catch (e) {
// core.error(
// `Error from 'git rev-parse --verfy ${pull.base.ref}': ${
// (e as Error).message
// }`
// )
// }

// if (!baseRefExists) {
// core.setFailed(
// `Could not find pull request base branch ${pull.base.ref}. ` +
// `Please make sure actions/checkout was used beforehand to fetch ${pull.base.ref}.`
// )
// return
// }

core.debug(
`Fetching base ref "${pull.base.ref}" and head ref "${pull.head.ref}"`
)
core.debug(`Cloning just the base ref "${pull.base.ref}"`)
const cloneUrl = `https://${core.getInput('token')}@github.com/${
github.context.repo.owner
}/${github.context.repo.repo}`
await git.clone(cloneUrl, '.', [
`--branch=${pull.base.ref}`,
'--filter=tree:0',
'--no-tags',
'--single-branch'
])

core.debug(`Fetching head ref "${pull.head.ref}"`)
await git.fetch([
'origin',
`+${pull.base.ref}:${pull.base.ref}`,
`+${pull.head.ref}:${pull.head.ref}`,
`--filter=tree:0`,
'--no-tags',
Expand Down

0 comments on commit a7d52be

Please sign in to comment.