deepseek重写toml文件
Some checks failed
Auto Update README with Repo Name / update-readme (push) Failing after 9s

This commit is contained in:
liyp 2025-04-10 14:48:30 +08:00
parent 4796ddf686
commit d365f8f27f

View File

@ -1,52 +1,37 @@
name: Generate README based on repo name and commits name: Auto Update README with Repo Name
on: on:
push: push:
branches: branches:
- main # 可根据实际情况修改为你的默认分支 - main
jobs: jobs:
generate-readme: update-readme:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: ActionDemo - name: Checkout code (Gitea version)
run: | uses: https://gitea.com/actions/checkout.git
git clone https://git.linuxacme.com/iorebuild/ActionDemo.git . with:
fetch-depth: 0
- name: Get repository name - name: Extract repository name
id: repo-name run: echo "REPO_NAME=ActionDemo" >> $GITHUB_ENV
run: |
REPO_NAME=$(echo ${{ github.repository }} | cut -d '/' -f 2)
echo "::set-output name=name::$REPO_NAME"
- name: Get recent commits - name: Create or update README
id: recent-commits
run: | run: |
COMMITS=$(git log --pretty=format:"- %s (%an, %ad)" --date=short -n 5) if [ ! -f README.md ]; then
echo "::set-output name=commits::$COMMITS" echo "# $REPO_NAME" > README.md
echo -e "\nThis repository is automatically maintained by Gitea Actions." >> README.md
- name: Generate README else
run: | if ! grep -q "^# $REPO_NAME" README.md; then
cat << EOF > README.md sed -i "1i# $REPO_NAME" README.md
# ${{ steps.repo-name.outputs.name }} fi
fi
## Recent Commits
${{ steps.recent-commits.outputs.commits }}
EOF
- name: Commit and push changes - name: Commit and push changes
env:
GIT_REPO_TOKEN: ${{ secrets.AUTOGENERATEREADME }} # 假设你已经将令牌存储为 GITHUB_TOKEN 机密
run: | run: |
git config --local user.email "liyepan@linuxacme.com" git config --global user.name "iorebuild"
git config --local user.name "iorebuild" git config --global user.email "liyepan@linuxacme.com"
git config --global credential.helper store
echo "https://${GIT_REPO_TOKEN}@git.linuxacme.com" > ~/.git-credentials
git add README.md git add README.md
if git diff --staged --quiet; then git diff --quiet && git diff --staged --quiet || git commit -m "Auto-update: Add repository name to README"
echo "No changes to README.md. Skipping commit." git push
else
git commit -m "Update README with recent commits"
git push https://${GIT_REPO_TOKEN}@git.linuxacme.com/iorebuild/ActionDemo.git
fi