测试自动生成readme
Some checks failed
Generate README based on repo name and commits / generate-readme (push) Failing after 8m5s
Some checks failed
Generate README based on repo name and commits / generate-readme (push) Failing after 8m5s
This commit is contained in:
parent
c4f29866bb
commit
b583d901ee
49
.gitea/workflows/AutoGenerateREADME.yaml
Normal file
49
.gitea/workflows/AutoGenerateREADME.yaml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
name: Generate README based on repo name and commits
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main # 可根据实际情况修改为你的默认分支
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate-readme:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
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: Get recent commits
|
||||||
|
id: recent-commits
|
||||||
|
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
|
||||||
|
|
||||||
|
- 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 README.md. Skipping commit."
|
||||||
|
else
|
||||||
|
git commit -m "Update README with recent commits"
|
||||||
|
git push
|
||||||
|
fi
|
@ -1,18 +0,0 @@
|
|||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ github.actor }} is testing out Gitea Actions
|
|
||||||
on: [push]
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo " The job was automatically triggered by a ${{ github.event_name }} event."
|
|
||||||
- run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- run: echo " The ${{ github.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo " ️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ github.workspace }}
|
|
||||||
- run: echo " This job's status is ${{ job.status }}."
|
|
Loading…
Reference in New Issue
Block a user