🔒 fix: prevent CI loops and add proper git authentication
Some checks failed
CI/CD Pipeline / CI Pipeline (pull_request) Has been cancelled
Some checks failed
CI/CD Pipeline / CI Pipeline (pull_request) Has been cancelled
This commit is contained in:
@@ -54,6 +54,7 @@ jobs:
|
|||||||
ci-pipeline:
|
ci-pipeline:
|
||||||
name: CI Pipeline
|
name: CI Pipeline
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'ci-bot'"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -101,11 +102,16 @@ jobs:
|
|||||||
BADGE_URL="https://img.shields.io/badge/coverage-${COVERAGE}%-${COLOR}?style=flat-square"
|
BADGE_URL="https://img.shields.io/badge/coverage-${COVERAGE}%-${COLOR}?style=flat-square"
|
||||||
sed -i "s|https://img.shields.io/badge/coverage-.*-.*?style=flat-square|${BADGE_URL}|" README.md
|
sed -i "s|https://img.shields.io/badge/coverage-.*-.*?style=flat-square|${BADGE_URL}|" README.md
|
||||||
|
|
||||||
# Commit and push the update
|
# Set up git authentication and commit
|
||||||
git config --global user.name "CI Bot"
|
git config --global user.name "CI Bot"
|
||||||
git config --global user.email "ci@arcodange.fr"
|
git config --global user.email "ci@arcodange.fr"
|
||||||
|
|
||||||
|
# Set up credentials using Gitea token
|
||||||
|
git config --global credential.helper store
|
||||||
|
echo "https://${{ secrets.PACKAGES_TOKEN }}@gitea.arcodange.lab" > ~/.git-credentials
|
||||||
|
|
||||||
git add README.md
|
git add README.md
|
||||||
git commit -m "🤖 chore: update coverage badge to ${COVERAGE}%" || echo "No coverage change to commit"
|
git commit -m "🤖 chore: update coverage badge to ${COVERAGE}% [skip ci]" || echo "No coverage change to commit"
|
||||||
git push || echo "Push failed - may be duplicate commit"
|
git push || echo "Push failed - may be duplicate commit"
|
||||||
|
|
||||||
- name: Run go fmt
|
- name: Run go fmt
|
||||||
|
|||||||
Reference in New Issue
Block a user