mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 00:42:08 +02:00
Checkout all branches in GitHub Actions (#4437)
By default actions/checkout@v2 only checks out the latest commit of the current branch. Unfortunately, this causes the `git diff` check in `check-pr.sh` to fail, as `master` branch isn't available`. This change checks out all commits of all branches, which allows `git diff` to work correctly. Ideally, I'd like to use the `ref` setting of actions/checkout@v2, but that only supports a single ref so it's not possible to checkout the PR branch _and_ `master` branch at the same time.
This commit is contained in:
parent
2c7e2351e8
commit
34f8c610df
2 changed files with 3 additions and 1 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -12,6 +12,8 @@ jobs:
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up PR environment
|
- name: Set up PR environment
|
||||||
if: github.event.number != null
|
if: github.event.number != null
|
||||||
|
|
|
@ -49,7 +49,7 @@ function check_diff {
|
||||||
local line
|
local line
|
||||||
local entry
|
local entry
|
||||||
|
|
||||||
git_diff=$(git diff --name-status --find-copies-harder --diff-filter=AC --relative=pages/ master)
|
git_diff=$(git diff --name-status --find-copies-harder --diff-filter=AC --relative=pages/ remotes/origin/master)
|
||||||
|
|
||||||
if [ -n "$git_diff" ]; then
|
if [ -n "$git_diff" ]; then
|
||||||
echo -e "Check PR: git diff:\n$git_diff" >&2
|
echo -e "Check PR: git diff:\n$git_diff" >&2
|
||||||
|
|
Loading…
Add table
Reference in a new issue