diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 4b0af5a..46347ee 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -16,9 +16,29 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 - with: - github-server-url: ${{ github.server_url }} + env: + SERVER_URL: ${{ github.server_url }} + REPOSITORY: ${{ github.repository }} + COMMIT_SHA: ${{ github.sha }} + GIT_USERNAME: ${{ github.actor }} + GIT_TOKEN: ${{ github.token }} + run: | + case "$SERVER_URL" in + http://*) + AUTH_SERVER_URL="http://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#http://}" + ;; + https://*) + AUTH_SERVER_URL="https://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#https://}" + ;; + *) + AUTH_SERVER_URL="$SERVER_URL" + ;; + esac + + git init . + git remote add origin "${AUTH_SERVER_URL}/${REPOSITORY}.git" + git fetch --depth=1 origin "$COMMIT_SHA" + git checkout --detach FETCH_HEAD - name: Normalize image metadata env: