This commit is contained in:
parent
0000cf662c
commit
d70e5af7d2
@ -1,38 +1,22 @@
|
||||
name: Auto Update README with Repo Name
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update-readme:
|
||||
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
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code (Gitea version)
|
||||
uses: https://gitea.com/gitea/act/src/branch/master/actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Extract repository name
|
||||
run: echo "REPO_NAME=ActionDemo" >> $GITHUB_ENV
|
||||
|
||||
- name: Create or update README
|
||||
run: |
|
||||
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
|
||||
run: |
|
||||
git config --global user.name "iorebuild"
|
||||
git config --global user.email "liyepan@linuxacme.com"
|
||||
git add README.md
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "Auto-update: Add repository name to README"
|
||||
git push
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
Loading…
Reference in New Issue
Block a user