Skip to content

Optimizing up-to-date on bigger repos to not require fetch-depth 0 #99

@pmalek

Description

@pmalek

Problem statement

https://github.com/Kong/public-shared-actions/tree/main/pr-previews#up-to-date seems to require fetch-depth 0 which in turn causes long check outs in bigger repos.

For instance, in KIC's repo a check out is already over a minute: https://github.com/Kong/kubernetes-ingress-controller/actions/runs/8342150986/job/22829697425#step:2:335.

Taking into account that this is going to only grow with time I believe it's worth considering how the above can be optimized.

We've tried to use the default (1) fetch-depth https://github.com/Kong/kubernetes-ingress-controller/pull/5718/files#diff-4af11422a4987e947e5a47adead7a30d32cdb2db82e2d3fe36f8e6cbe84d5ac5L30-L31 but that failed and we needed to revert that change.

What did you observe

We either got:

Run # if a request error occurred or no pull request info was returned, skip logic and return false
From https://github.com/Kong/kubernetes-ingress-controller
 * branch            main       -> FETCH_HEAD
From https://github.com/Kong/kubernetes-ingress-controller
 * branch              b70a95c8ff9743831d4b1c1833b0c080f0443085 -> FETCH_HEAD
fatal: ambiguous argument 'origin/main~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error: Process completed with exit code 128.

or

From https://github.com/Kong/kubernetes-ingress-controller
 * branch            main       -> FETCH_HEAD
From https://github.com/Kong/kubernetes-ingress-controller
 * branch              980081dc7abe9bcc93a16622109ca07ab6e27d0e -> FETCH_HEAD
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions