question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optimise fetching all commits in a pull request

See original GitHub issue

My goal is to lint all commit messages in a pull request, or in other words, since branching off the default branch. My workaround is

    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
        ref: ${{ github.event.pull_request.head.sha }}
    # grab default branch to calculate branch point to know when to stop linting
    - if: ${{ github.base_ref }}
      run: git branch ${{ github.base_ref }} origin/${{ github.base_ref }}

but for large repos, it would be nice if this action could do the smart thing and only fetch what is needed. Thanks in advance.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

3reactions
polarathenecommented, Jul 2, 2022

I don’t see anything in the pull_request body that tells me how many commits to fetch if you do a shallow clone

${{ github.event.pull_request.commits }} is available for that. I guess it was not a year ago.

1reaction
ericzolfcommented, Jan 10, 2021

My use case is different but the need is the same: I want to be able to list all files changed in the PR (and decide accordingly if a step needs to be run) but it can only work if the base_ref is also fetched, which currently, not knowing the number of commits required, can only be done by fetching the whole repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Optimize Your Pull Requests for Effective Code Reviews
Prepare a clear commit history ... Thorough use of partial-staging, amending, and rebasing are all tools that will help achieve a clean commit...
Read more >
Using git rebase and git merge to optimise your pull requests
open editor with a file that lists all the commits that exist between develop and your branch; you can edit that file and...
Read more >
Tips for improving git performance - Cognizant Softvision
Limit the number of commits you have in a branch. · Delete unused branches, also when merging a pull request, make sure you...
Read more >
GitHub pull request showing commits that are already in target ...
Here's a good workaround. Use the Edit button when viewing the PR in GitHub to change the base branch to something other than...
Read more >
How to Improve Your Pull Request Workflow - Waydev
Get in touch ... Git Pull Requests have been used to review code on branches before it ... Putting a Jira issue key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found