|
49 | 49 | gh api "repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \ |
50 | 50 | -f content='rocket' --silent |
51 | 51 |
|
| 52 | + - name: Post in-progress comment |
| 53 | + id: progress-comment |
| 54 | + env: |
| 55 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + run: | |
| 57 | + COMMENT_URL=$(gh issue comment "${{ github.event.issue.number }}" \ |
| 58 | + --repo "${{ github.repository }}" \ |
| 59 | + --body "Rebase workflow **in progress**... [View run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})") |
| 60 | + COMMENT_ID=$(echo "$COMMENT_URL" | grep -oE '[0-9]+$') |
| 61 | + echo "comment_id=${COMMENT_ID}" >> "$GITHUB_OUTPUT" |
| 62 | +
|
52 | 63 | - name: Checkout dw-claude-runner |
53 | 64 | uses: actions/checkout@v4 |
54 | 65 | with: |
@@ -91,26 +102,20 @@ jobs: |
91 | 102 | fi |
92 | 103 | echo "pr_url=${PR_URL}" >> "$GITHUB_OUTPUT" |
93 | 104 |
|
94 | | - - name: Comment success on issue |
95 | | - if: success() |
| 105 | + - name: Update comment with result |
| 106 | + if: always() && steps.progress-comment.outputs.comment_id |
96 | 107 | env: |
97 | 108 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
98 | 109 | PR_URL: ${{ steps.extract-pr.outputs.pr_url }} |
| 110 | + COMMENT_ID: ${{ steps.progress-comment.outputs.comment_id }} |
| 111 | + RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
99 | 112 | run: | |
100 | | - if [ -n "$PR_URL" ]; then |
101 | | - BODY="Rebase workflow **succeeded**. [View run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\nCreated PR: ${PR_URL}" |
| 113 | + if [ "${{ job.status }}" = "success" ] && [ -n "$PR_URL" ]; then |
| 114 | + BODY="Rebase workflow **succeeded**. [View run](${RUN_URL})\n\nCreated PR: ${PR_URL}" |
| 115 | + elif [ "${{ job.status }}" = "success" ]; then |
| 116 | + BODY="**Warning**: Workflow completed but no PR was created. Something may have gone wrong. [View logs](${RUN_URL})" |
102 | 117 | else |
103 | | - BODY="**Warning**: Workflow completed but no PR was created. Something may have gone wrong. [View logs](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" |
| 118 | + BODY="Rebase workflow **failed**. [View run](${RUN_URL})" |
104 | 119 | fi |
105 | | - gh issue comment "${{ github.event.issue.number }}" \ |
106 | | - --repo "${{ github.repository }}" \ |
107 | | - --body "$(echo -e "$BODY")" |
108 | | -
|
109 | | - - name: Comment failure on issue |
110 | | - if: failure() |
111 | | - env: |
112 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
113 | | - run: | |
114 | | - gh issue comment "${{ github.event.issue.number }}" \ |
115 | | - --repo "${{ github.repository }}" \ |
116 | | - --body "Rebase workflow **failed**. [View run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" |
| 120 | + gh api "repos/${{ github.repository }}/issues/comments/${COMMENT_ID}" \ |
| 121 | + -X PATCH -f body="$(echo -e "$BODY")" |
0 commit comments