ActionDemo/.gitea/workflows/AutoGenerateREADME.yaml
liyp f7d7f72209
Some checks failed
Create README / create-readme (push) Failing after 8s
clone多了一个htpps
2025-04-10 15:26:55 +08:00

39 lines
1.2 KiB
YAML

name: Create README
on:
push:
branches:
- main # 可根据实际情况修改为你的默认分支,如 master
jobs:
create-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
env:
GITEA_TOKEN: ${{ secrets.AUTOGENERATE }}
GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
run: |
git clone "${GITEA_TOKEN}@${GITEA_REPO_URL}" .
- name: Create README
run: |
# 获取仓库名称
REPO_NAME=$(basename "$GITHUB_REPOSITORY" .git)
# 创建 README.md 文件并添加仓库名称
echo "$REPO_NAME" > README.md
# 显示 README.md 的内容(可选,用于调试)
cat README.md
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
if git diff --staged --quiet; then
echo "No changes to commit."
else
git commit -m "Create README with repository name"
git push "https://AUTOGENERATE@${{ github.server_url }}/${{ github.repository }}"
fi