避免重复action

This commit is contained in:
liyp 2025-04-10 15:37:11 +08:00
parent e721d3b162
commit 2d4e6cf07c

View File

@ -1,4 +1,4 @@
name: Create README name: Create README with Commit History
on: on:
push: push:
@ -8,6 +8,7 @@ on:
jobs: jobs:
create-readme: create-readme:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'Create README with commit history')"
steps: steps:
- name: Checkout code from Gitea - name: Checkout code from Gitea
@ -45,12 +46,12 @@ jobs:
run: | run: |
# 去除多余的 https:// # 去除多余的 https://
CLEAN_REPO_URL="${CLEAN_REPO_URL#https://}" CLEAN_REPO_URL="${CLEAN_REPO_URL#https://}"
git config --local user.email "action@github.com" git config --local user.email "liyepan@linuxacme.com"
git config --local user.name "GitHub Action" git config --local user.name "iorebuild"
git add README.md git add README.md
if git diff --staged --quiet; then if git diff --staged --quiet; then
echo "No changes to commit." echo "No changes to commit."
else else
git commit -m "Create README with repository name" git commit -m "Create README with commit history"
git push "https://${GITEA_TOKEN}@${CLEAN_REPO_URL}" git push "https://${GITEA_TOKEN}@${CLEAN_REPO_URL}"
fi fi