From e37904a3779a332d5afbaf5c5678b5cb8f144f8e Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 6 Feb 2026 08:16:51 -0500 Subject: [PATCH] fix: use git push instead of Gitea API for checksum update The Gitea Contents API returned HTTP error (curl exit 22) when the CI tried to update artifacthub-pkg.yml. Switch to using git checkout/commit/push which reuses the auth already configured by actions/checkout. Also added fetch-depth: 0 so the main branch is available for checkout. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/release.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 5933f73..3df1682 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install dependencies run: npm ci @@ -34,19 +36,17 @@ jobs: - name: Update artifacthub-pkg.yml on main run: | VERSION=${GITHUB_REF_NAME#v} + git checkout main sed -i "s|headlamp/plugin/archive-checksum:.*|headlamp/plugin/archive-checksum: sha256:${CHECKSUM}|" artifacthub-pkg.yml sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"https://github.com/cpfarhood/polaris-headlamp-plugin/releases/download/${GITHUB_REF_NAME}/polaris-headlamp-plugin-${VERSION}.tar.gz\"|" artifacthub-pkg.yml sed -i "s|^version:.*|version: ${VERSION}|" artifacthub-pkg.yml - FILE_SHA=$(curl -sf \ - -H "Authorization: token ${{ github.token }}" \ - "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/contents/artifacthub-pkg.yml?ref=main" \ - | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>console.log(JSON.parse(d).sha))") - CONTENT=$(base64 -w 0 artifacthub-pkg.yml) - curl -sf -X PUT \ - -H "Authorization: token ${{ github.token }}" \ - -H "Content-Type: application/json" \ - "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/contents/artifacthub-pkg.yml" \ - -d "{\"content\":\"${CONTENT}\",\"sha\":\"${FILE_SHA}\",\"message\":\"ci: update artifact hub metadata for ${GITHUB_REF_NAME}\",\"branch\":\"main\"}" + git config user.name "gitea-actions[bot]" + git config user.email "gitea-actions[bot]@git.farh.net" + git add artifacthub-pkg.yml + git diff --cached --quiet || { + git commit -m "ci: update artifact hub metadata for ${GITHUB_REF_NAME}" + git push origin main + } - name: Install Docker CLI run: apt-get update && apt-get install -y docker.io