Scheduled Update of Release Notes #42
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Scheduled Update of Release Notes | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 2 * * 3" # Runs every Wednesday at 2:00 UTC (10:00 Beijing Time) | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| run-script: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| RELEASE_NOTES_FILE: ${{ secrets.RELEASE_NOTES_FILE }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| cache: pip | |
| - name: Install dependencies | |
| run: pip install requests pandas pyyaml jq mdformat | |
| - name: Prepare branch | |
| id: prepare_branch | |
| run: | | |
| BRANCH="update-rel-notes-${{ github.run_id }}" | |
| git switch -c "$BRANCH" | |
| echo "branch=$BRANCH" >> $GITHUB_OUTPUT | |
| - name: Run Script | |
| id: run_script | |
| env: | |
| FEISHU_SECRET: ${{ secrets.FEISHU_SECRET }} | |
| run: | | |
| set -e | |
| IFS=',' read -r APP_ID APP_SECRET URL <<< "$FEISHU_SECRET" | |
| export APP_ID APP_SECRET URL FILENAME="$RELEASE_NOTES_FILE" | |
| python scripts/auto-release-notes.py | |
| - name: Check Changes | |
| id: check_changes | |
| run: | | |
| if [ ! -f "$RELEASE_NOTES_FILE" ]; then | |
| echo "❌ Release notes file not found: $RELEASE_NOTES_FILE" | |
| exit 1 | |
| fi | |
| if git diff --quiet origin/main -- "$RELEASE_NOTES_FILE"; then | |
| echo "files_are_same=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "files_are_same=false" >> $GITHUB_OUTPUT | |
| git diff --stat origin/main -- "$RELEASE_NOTES_FILE" | |
| fi | |
| - name: Commit and Push If Changes Exist | |
| id: commit_and_push | |
| if: steps.check_changes.outputs.files_are_same == 'false' | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: Update rel-notes.md via automation | |
| file_pattern: ${{ secrets.RELEASE_NOTES_FILE }} | |
| skip_dirty_check: true | |
| push_options: --set-upstream | |
| branch: ${{ steps.prepare_branch.outputs.branch }} | |
| - name: Create Pull Request If Push Succeeded | |
| if: steps.commit_and_push.outcome == 'success' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh pr create \ | |
| --title "Automated update of rel-notes.md" \ | |
| --body "This PR updates rel-notes.md automatically." \ | |
| --base main \ | |
| --head "${{ steps.prepare_branch.outputs.branch }}" \ | |
| --repo "${{ github.repository }}" |