Compare commits

...

2 Commits

Author SHA1 Message Date
Zanie
d8935ec7ce Always configure user 2023-11-02 10:02:47 -05:00
Zanie
7e6584039e Cache repository checkouts during ecosystem checks 2023-11-02 00:22:55 -05:00
2 changed files with 41 additions and 28 deletions

View File

@@ -209,6 +209,12 @@ jobs:
run: |
pip install ./python/ruff-ecosystem
- name: Restore cached checkouts
uses: actions/cache/restore@v3
with:
path: ./checkouts
key: ecosystem-checkouts
- name: Run `ruff check` stable ecosystem check
if: ${{ needs.determine_changes.outputs.linter == 'true' }}
run: |
@@ -273,6 +279,12 @@ jobs:
cat ecosystem-result-format-preview >> ecosystem-result
echo "" >> ecosystem-result
- name: Save cached checkouts
uses: actions/cache/save@v3
with:
path: ./checkouts
key: ecosystem-checkouts
- name: Export pull request number
run: |
echo ${{ github.event.number }} > pr-number

View File

@@ -162,38 +162,39 @@ class Repository(Serializable):
logger.debug(f"Pulling latest changes for {self.fullname} @ {self.ref}")
await cloned_repo.pull()
return cloned_repo
else:
logger.debug(f"Cloning {self.owner}:{self.name} to {checkout_dir}")
command = [
"git",
"clone",
"--config",
"advice.detachedHead=false",
"--quiet",
"--depth",
"1",
"--no-tags",
]
if self.ref:
command.extend(["--branch", self.ref])
logger.debug(f"Cloning {self.owner}:{self.name} to {checkout_dir}")
command = [
"git",
"clone",
"--config",
"advice.detachedHead=false",
"--quiet",
"--depth",
"1",
"--no-tags",
]
if self.ref:
command.extend(["--branch", self.ref])
command.extend(
[
f"https://github.com/{self.owner}/{self.name}",
str(checkout_dir),
],
)
command.extend(
[
f"https://github.com/{self.owner}/{self.name}",
str(checkout_dir),
],
)
process = await create_subprocess_exec(
*command, env={"GIT_TERMINAL_PROMPT": "0"}
)
process = await create_subprocess_exec(
*command, env={"GIT_TERMINAL_PROMPT": "0"}
)
status_code = await process.wait()
status_code = await process.wait()
logger.debug(
f"Finished cloning {self.fullname} with status {status_code}",
)
logger.debug(
f"Finished cloning {self.fullname} with status {status_code}",
)
cloned_repo = await ClonedRepository.from_path(checkout_dir, self)
# Configure git user — needed for `self.commit` to work
await (
@@ -216,7 +217,7 @@ class Repository(Serializable):
)
).wait()
return await ClonedRepository.from_path(checkout_dir, self)
return cloned_repo
@dataclass(frozen=True)