|
59 | 59 | pr-comment: |
60 | 60 | runs-on: ubuntu-latest |
61 | 61 | env: |
62 | | - MESSAGE_FILE: "artifacts/${{ inputs.artifact_name}}" |
63 | 62 | TARGET: "${{ inputs.target_repo }}" |
64 | 63 | steps: |
65 | 64 | - name: Validate inputs |
@@ -101,26 +100,28 @@ jobs: |
101 | 100 |
|
102 | 101 | - name: Download message artifact |
103 | 102 | if: ${{ steps.check_pr.outputs.proceed == 'true'}} |
| 103 | + id: download |
104 | 104 | uses: actions/download-artifact@v5 |
105 | 105 | with: |
106 | | - run_id: "${{ inputs.run_id }}" |
| 106 | + run-id: "${{ inputs.run_id }}" |
107 | 107 | repository: "${{ env.TARGET }}" |
108 | 108 | name: "${{ inputs.artifact_name }}" |
109 | 109 | path: artifacts/ |
110 | | - github_token: ${{secrets.GITHUB_TOKEN}} |
| 110 | + github-token: ${{secrets.GITHUB_TOKEN}} |
111 | 111 |
|
112 | 112 | - name: Check message artifact size |
113 | 113 | if: ${{ steps.check_pr.outputs.proceed == 'true'}} |
114 | | - id: load_artifact |
115 | 114 | run: | |
| 115 | + MESSAGE_FILE="${{ steps.download.outputs.download-path }}/${{ inputs.artifact_name }}" |
116 | 116 | SIZE=$(wc -c "${MESSAGE_FILE}") |
117 | 117 | if [[ "${SIZE}" -gt "${{ env.MAX_MESSAGE_SIZE }}" ]] ; then |
118 | 118 | # truncate the message up to MAX_MESSAGE_SIZE |
119 | 119 | head -c ${{ env.MAX_MESSAGE_SIZE }} "${MESSAGE_FILE}" > /tmp/truncated |
| 120 | + echo > /tmp/truncated |
| 121 | + echo "... (truncated)" > /tmp/truncated |
120 | 122 | mv /tmp/truncated "${MESSAGE_FILE}" |
121 | 123 | echo "::warning:: comment message with size ${SIZE} has been truncated to ${{ env.MAX_MESSAGE_SIZE }} bytes." |
122 | 124 | fi |
123 | | - echo "message=$(cat ${MESSAGE_FILE})" >> "${GITHUB_OUTPUT}" |
124 | 125 |
|
125 | 126 | - name: Find previous PR comment |
126 | 127 | if: ${{ steps.check_pr.outputs.proceed == 'true'}} |
@@ -149,11 +150,10 @@ jobs: |
149 | 150 | comment-id: ${{ steps.find_comment.outputs.comment-id }} |
150 | 151 | reactions: ${{ inputs.reactions }} |
151 | 152 | reactions-edit-mode: replace |
152 | | - body-path: ${{ env.MESSAGE_FILE }} |
| 153 | + body-path: ${{ steps.download.outputs.download-path }}/${{ inputs.artifact_name }} |
153 | 154 | edit-mode: replace |
154 | 155 | token: ${{ steps.acquire_write_token.outputs.token }} |
155 | 156 |
|
156 | 157 | - name: Notify |
157 | 158 | run: | |
158 | 159 | echo "::notice::Commented pull request ${{ inputs.pr_number }}" |
159 | | - echo "::debug::${{ steps.load_artifacts.outputs.message }}" |
0 commit comments