chore(deps): update reviewdog/action-shellcheck action to v1.28.0 #22
Workflow file for this run
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: PR Commit Message Update | |
| on: | |
| pull_request: | |
| jobs: | |
| update-commit-message: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get the list of commit messages | |
| run: | | |
| EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
| echo "COMMIT_LOGS<<$EOF" >> "$GITHUB_ENV" | |
| git log --format="* %s" origin/${{ github.event.pull_request.base.ref }}..HEAD~1 --reverse >> "$GITHUB_ENV" | |
| echo "$EOF" >> "$GITHUB_ENV" | |
| - name: Set the output | |
| uses: actions/github-script@v7 | |
| id: set-result | |
| with: | |
| script: | | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number | |
| }); | |
| // PR description | |
| const description = pr.body || ""; | |
| // Check if "--- commit logs ---" exists | |
| const marker = "--- commit logs ---"; | |
| const commitLogs = process.env.COMMIT_LOGS || "Default commit logs"; | |
| let newDescription; | |
| const markerIndex = description.indexOf(marker); | |
| if (markerIndex !== -1) { | |
| // If marker exists, replace everything after it | |
| newDescription = description.substring(0, markerIndex + marker.length) + "\n" + commitLogs; | |
| } else { | |
| // If marker doesn't exist, append it to the description | |
| newDescription = description + "\n\n" + marker + "\n" + commitLogs; | |
| } | |
| // Output the new description | |
| core.setOutput("new_description", newDescription); | |
| // Update the PR with the new description | |
| await github.rest.pulls.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number, | |
| body: newDescription | |
| }); | |
| github-token: ${{ secrets.GITHUB_TOKEN }} |