Skip to content

Commit

Permalink
Update update-changelog.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
molanp authored Oct 27, 2024
1 parent e5c3266 commit 1177d85
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ on:
branches:
- dev

permissions:
contents: write # 允许写入内容,以便更新 CHANGELOG.md

jobs:
update-changelog:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Set up Git
run: |
Expand Down Expand Up @@ -49,33 +52,8 @@ jobs:
echo "" >> CHANGELOG.md
fi
- name: Create a new branch
run: |
git checkout -b update-changelog
- name: Commit changes
- name: Commit and Push Changes
run: |
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md with latest commits on ${{ env.DATE }}" || echo "No changes to commit"
- name: Push changes to remote
run: |
git push origin update-changelog
- name: Check for open PR from GitHub Action bot
id: check_pr
run: |
OPEN_PR=$(gh pr list --base dev --state open --json author --jq '[.[] | select(.author.login == "github-actions[bot]")] | length')
echo "OPEN_PR=$OPEN_PR" >> $GITHUB_ENV
- name: Create Pull Request
if: env.OPEN_PR == '0'
run: |
gh pr create --title "Update CHANGELOG.md" --body "This PR updates the CHANGELOG with the latest commits." --base dev --head update-changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup branch (optional)
if: github.event.action == 'closed'
run: |
git branch -D update-changelog
git commit -m "Update CHANGELOG.md with latest commits" || echo "No changes to commit"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/Passer1072/RookieAI_yolov8 HEAD:dev

0 comments on commit 1177d85

Please sign in to comment.