diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9fc54f6c1..2288a0124 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Refresh dependencies run: sudo apt update - name: Install dependencies diff --git a/contrib/reformat-code.py b/contrib/reformat-code.py index 03dbefd85..69dfbdd13 100755 --- a/contrib/reformat-code.py +++ b/contrib/reformat-code.py @@ -32,9 +32,14 @@ def select_clang_version(formatters): ## Entry Point ## if __name__ == "__main__": + base = os.getenv("GITHUB_BASE_REF") + if base: + base = "origin/%s" % base + else: + base = "HEAD" formatter = select_clang_version(CLANG_DIFF_FORMATTERS) ret = subprocess.run( - ["git", "diff", "-U0", "HEAD"], capture_output=True, check=True, text=True + ["git", "diff", "-U0", base], capture_output=True, check=True, text=True ) if ret.returncode: print("Failed to run git diff: %s" % ret.stderr)