From b5d72706c5514cb19dea22ce63d75a8fef9865c9 Mon Sep 17 00:00:00 2001 From: liyp Date: Thu, 10 Apr 2025 15:25:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99toml=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/AutoGenerateREADME.yaml | 44 ++++++++++++++++-------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/AutoGenerateREADME.yaml b/.gitea/workflows/AutoGenerateREADME.yaml index daab3ff..5ecade5 100644 --- a/.gitea/workflows/AutoGenerateREADME.yaml +++ b/.gitea/workflows/AutoGenerateREADME.yaml @@ -1,23 +1,39 @@ -name: Release Drafter +name: Create README on: push: branches: - - main - pull_request: - types: [opened, reopened, synchronize] - -permissions: - contents: read + - main # 可根据实际情况修改为你的默认分支,如 master jobs: - update_release_draft: - permissions: - contents: write # for release-drafter/release-drafter to create a github release - pull-requests: write # for release-drafter/release-drafter to add label to PR + create-readme: runs-on: ubuntu-latest + steps: - - name: Run Release Drafter - uses: https://gitea.com/actions/release-drafter@v5 # 使用 Gitea 的镜像 + - name: Checkout code env: - GITEA_TOKEN: ${{ secrets.AUTOGENERATE }} # 使用 GITEA_TOKEN + GITEA_TOKEN: ${{ secrets.AUTOGENERATE }} + GITEA_REPO_URL: ${{ github.server_url }}/${{ github.repository }} + run: | + git clone "https://${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 \ No newline at end of file