IPC Patch (#3998) #3605
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: Update Changelog | |
| on: | |
| push: | |
| branches: | |
| - Starlight | |
| - starlight-dev | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| actions: read | |
| env: | |
| BRANCH_NAME: ${{ github.ref_name }} | |
| jobs: | |
| wait-for-que: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: "3.x" | |
| - name: Install Dependencies | |
| run: | | |
| pip install PyGithub | |
| - name: Wait for Que to finish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| WORKFLOW_RUN_NUMBER: ${{ github.run_number }} | |
| WORKFLOW_NAME: ${{ github.workflow }} | |
| run: | | |
| python ./Tools/_Starlight/wait_for_actions.py | |
| echo "Script exited with code $?" | |
| update-changelog: | |
| runs-on: ubuntu-latest | |
| needs: wait-for-que | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Get Pull Request Number via GH | |
| id: get_pr | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const pr = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| commit_sha: context.sha | |
| }); | |
| if (pr.data.length === 0) { | |
| console.log("No PR found for this branch. Skipping changelog update."); | |
| return ""; | |
| } | |
| console.log(`PR Number: ${pr.data[0].number}`); | |
| return pr.data[0].number; | |
| #re checkout | |
| - name: Re-checkout repository | |
| if: steps.get_pr.outputs.result != '' | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.ref }} | |
| - name: Set up Python | |
| if: steps.get_pr.outputs.result != '' | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Dependencies | |
| if: steps.get_pr.outputs.result != '' | |
| run: | | |
| pip install pyyaml PyGithub | |
| - name: Parse PR and Update Changelog | |
| if: steps.get_pr.outputs.result != '' | |
| env: | |
| CHANGELOG_FILE_PATH: 'Resources/Changelog/ChangelogStarlight.yml' | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ steps.get_pr.outputs.result }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| python ./Tools/_Starlight/update_changelog.py | |
| echo "Script exited with code $?" | |
| - name: Display changelog after update | |
| if: steps.get_pr.outputs.result != '' | |
| run: | | |
| cat "Resources/Changelog/ChangelogStarlight.yml" | |
| - name: Git status before commit | |
| if: steps.get_pr.outputs.result != '' | |
| run: | | |
| git status | |
| - name: Commit and push changes | |
| if: steps.get_pr.outputs.result != '' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add "Resources/Changelog/ChangelogStarlight.yml" | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git pull | |
| git commit -m "Update changelog for PR #${{ steps.get_pr.outputs.result }} [skip ci]" | |
| git push | |
| fi | |