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