Compare commits
1 Commits
925f1a092d
...
9ed1fe84a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ed1fe84a1 |
@@ -10,48 +10,10 @@ jobs:
|
|||||||
runs-on: [self-hosted, linux]
|
runs-on: [self-hosted, linux]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare git repository
|
- name: Checkout
|
||||||
env:
|
uses: actions/checkout@v4
|
||||||
SERVER_URL: ${{ github.server_url }}
|
with:
|
||||||
REPOSITORY: ${{ github.repository }}
|
fetch-depth: 0
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
BEFORE_SHA: ${{ github.event.before }}
|
|
||||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
||||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
||||||
HEAD_SHA: ${{ github.sha }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
git init
|
|
||||||
fi
|
|
||||||
|
|
||||||
if git remote get-url origin >/dev/null 2>&1; then
|
|
||||||
git remote set-url origin "${SERVER_URL}/${REPOSITORY}.git"
|
|
||||||
else
|
|
||||||
git remote add origin "${SERVER_URL}/${REPOSITORY}.git"
|
|
||||||
fi
|
|
||||||
|
|
||||||
FETCH_CMD=(git fetch --force --prune --no-tags origin '+refs/heads/*:refs/remotes/origin/*')
|
|
||||||
if [ -n "${GITHUB_TOKEN:-}" ]; then
|
|
||||||
FETCH_CMD=(git -c "http.extraHeader=Authorization: Bearer ${GITHUB_TOKEN}" fetch --force --prune --no-tags origin '+refs/heads/*:refs/remotes/origin/*')
|
|
||||||
fi
|
|
||||||
|
|
||||||
"${FETCH_CMD[@]}"
|
|
||||||
|
|
||||||
for SHA in "${HEAD_SHA:-}" "${PR_BASE_SHA:-}" "${PR_HEAD_SHA:-}" "${BEFORE_SHA:-}"; do
|
|
||||||
if [ -n "${SHA}" ] && [ "${SHA}" != "0000000000000000000000000000000000000000" ]; then
|
|
||||||
if [ -n "${GITHUB_TOKEN:-}" ]; then
|
|
||||||
git -c "http.extraHeader=Authorization: Bearer ${GITHUB_TOKEN}" fetch --no-tags origin "${SHA}" || true
|
|
||||||
else
|
|
||||||
git fetch --no-tags origin "${SHA}" || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -n "${HEAD_SHA:-}" ] && git cat-file -e "${HEAD_SHA}^{commit}" 2>/dev/null; then
|
|
||||||
git checkout --detach "${HEAD_SHA}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Validate commit messages
|
- name: Validate commit messages
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user