Skip to content

Commit

Permalink
checkout source when no repository is present
Browse files Browse the repository at this point in the history
  • Loading branch information
WolleTD committed Jan 27, 2024
1 parent 95b84cc commit 2e3de0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ jobs:
source-ref: ${{ matrix.src-ok }}
target-ref: ${{ matrix.target }}
- name: clear git repo
run: rm -rf .git
run: git rm -rf . && rm -rf .git
- name: test json is skipped
uses: ./.test/
with:
source-ref: ${{ matrix.src-ok }}
target-ref: ${{ matrix.target }}
clang-version: 12
- name: clear git repo
run: rm -rf .git
run: git rm -rf . && rm -rf .git
- name: test without source-ref (does nothing in this case, but should succeed)
uses: ./.test/
with:
target-ref: ${{ matrix.target }}
- name: clear git repo
run: rm -rf .git
run: git rm -rf . && rm -rf .git
- name: test with format error
uses: ./.test/
with:
Expand All @@ -56,7 +56,7 @@ jobs:
continue-on-error: true
id: fail1
- name: clear git repo
run: rm -rf .git
run: git rm -rf . && rm -rf .git
- name: test with git error
uses: ./.test/
with:
Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fi
if ! git status >/dev/null 2>&1; then
[ "$CI" ] || die "Not a git repository!"
[ "$ref" = "HEAD" ] && ref=$GITHUB_REF_NAME
checkout=1
echo "Initializing repository..."
git init -q "$PWD"
git remote add origin "https://github.com/$GITHUB_REPOSITORY"
Expand All @@ -47,6 +48,7 @@ if [ "$CI" ]; then
# Ensure that the source revision has some history (actions/checkout also uses depth=1)
ref=$(git rev-parse -q --verify "origin/$ref" || git rev-parse -q --verify "$ref")
git fetch -q "--depth=$FETCH_DEPTH" origin "+${ref}"
[ "$checkout" ] && git checkout "$ref"
fi

[ -z "$CLANG_VERSION" ] || set-clang-version "$CLANG_VERSION"
Expand Down

0 comments on commit 2e3de0e

Please sign in to comment.