|
34 | 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
35 | 35 | PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }} |
36 | 36 |
|
37 | | - fix-changelogs: |
| 37 | + update-changelogs: |
38 | 38 | name: Update changelogs |
39 | 39 | needs: is-fork-pull-request |
40 | 40 | if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }} |
|
66 | 66 | node-version: 22.x |
67 | 67 | ref: ${{ steps.pr.outputs.sha }} |
68 | 68 |
|
69 | | - # Checkout by branch name so validate-changelog.sh can detect release branches |
70 | | - - name: Checkout branch by name |
71 | | - run: git checkout "$PR_REF" |
| 69 | + # Fetch and checkout by branch name so git push targets the correct branch |
| 70 | + - name: Checkout PR branch |
| 71 | + run: | |
| 72 | + git fetch origin "$PR_REF" |
| 73 | + git checkout "$PR_REF" |
72 | 74 | env: |
73 | 75 | PR_REF: ${{ steps.pr.outputs.ref }} |
74 | 76 |
|
@@ -99,12 +101,16 @@ jobs: |
99 | 101 | - name: Comment result |
100 | 102 | if: always() |
101 | 103 | run: | |
102 | | - if [ "$CHANGED" = "true" ]; then |
| 104 | + if [ "$CHANGED" = "true" ] && [ "$VALIDATE_OUTCOME" = "failure" ]; then |
| 105 | + gh pr comment "$PR_NUMBER" --body "Changelogs updated and pushed, but some validation errors remain. Check the [workflow run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) for details." |
| 106 | + elif [ "$CHANGED" = "true" ]; then |
103 | 107 | gh pr comment "$PR_NUMBER" --body "Changelogs updated and pushed." |
104 | 108 | elif [ "$COMMIT_OUTCOME" = "failure" ]; then |
105 | 109 | gh pr comment "$PR_NUMBER" --body "Failed to push changelog fixes. Check the [workflow run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) for details." |
106 | 110 | elif [ "$VALIDATE_OUTCOME" = "failure" ]; then |
107 | 111 | gh pr comment "$PR_NUMBER" --body "Changelog validation failed. Check the [workflow run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) for details." |
| 112 | + elif [ "$VALIDATE_OUTCOME" = "skipped" ] || [ "$COMMIT_OUTCOME" = "skipped" ]; then |
| 113 | + gh pr comment "$PR_NUMBER" --body "Workflow failed before changelog validation. Check the [workflow run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) for details." |
108 | 114 | else |
109 | 115 | gh pr comment "$PR_NUMBER" --body "No changelog changes needed." |
110 | 116 | fi |
|
0 commit comments