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: | run: |
pip install ./python/ruff-ecosystem 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 - name: Run `ruff check` stable ecosystem check
if: ${{ needs.determine_changes.outputs.linter == 'true' }} if: ${{ needs.determine_changes.outputs.linter == 'true' }}
run: | run: |
@@ -273,6 +279,12 @@ jobs:
cat ecosystem-result-format-preview >> ecosystem-result cat ecosystem-result-format-preview >> ecosystem-result
echo "" >> 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 - name: Export pull request number
run: | run: |
echo ${{ github.event.number }} > pr-number echo ${{ github.event.number }} > pr-number

View File

@@ -162,8 +162,7 @@ class Repository(Serializable):
logger.debug(f"Pulling latest changes for {self.fullname} @ {self.ref}") logger.debug(f"Pulling latest changes for {self.fullname} @ {self.ref}")
await cloned_repo.pull() await cloned_repo.pull()
return cloned_repo else:
logger.debug(f"Cloning {self.owner}:{self.name} to {checkout_dir}") logger.debug(f"Cloning {self.owner}:{self.name} to {checkout_dir}")
command = [ command = [
"git", "git",
@@ -195,6 +194,8 @@ class Repository(Serializable):
f"Finished cloning {self.fullname} with status {status_code}", 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 # Configure git user — needed for `self.commit` to work
await ( await (
await create_subprocess_exec( await create_subprocess_exec(
@@ -216,7 +217,7 @@ class Repository(Serializable):
) )
).wait() ).wait()
return await ClonedRepository.from_path(checkout_dir, self) return cloned_repo
@dataclass(frozen=True) @dataclass(frozen=True)