|
27 | 27 | - name: Checkout trusted code |
28 | 28 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
29 | 29 |
|
| 30 | + - name: Find existing lifecycle comment |
| 31 | + id: find_comment |
| 32 | + uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0 |
| 33 | + with: |
| 34 | + issue-number: ${{ inputs.pr_number }} |
| 35 | + body-includes: "<!-- dependency-wheel-promotion pr=${{ inputs.pr_number }} sha=${{ inputs.head_sha }} -->" |
| 36 | + |
| 37 | + - name: Post lifecycle comment (started) |
| 38 | + id: started_comment |
| 39 | + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 |
| 40 | + with: |
| 41 | + issue-number: ${{ inputs.pr_number }} |
| 42 | + comment-id: ${{ steps.find_comment.outputs.comment-id }} |
| 43 | + edit-mode: replace |
| 44 | + body: | |
| 45 | + <!-- dependency-wheel-promotion pr=${{ inputs.pr_number }} sha=${{ inputs.head_sha }} --> |
| 46 | + Wheel promotion started for commit `${{ inputs.head_sha }}` by @${{ github.actor }}. |
| 47 | + Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 48 | +
|
30 | 49 | - name: Checkout PR lockfiles only |
31 | 50 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
32 | 51 | with: |
@@ -62,41 +81,57 @@ jobs: |
62 | 81 |
|
63 | 82 | - name: Set dependency-wheel-promotion status to success |
64 | 83 | uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 84 | + env: |
| 85 | + HEAD_SHA: ${{ inputs.head_sha }} |
65 | 86 | with: |
66 | 87 | script: | |
67 | 88 | await github.rest.repos.createCommitStatus({ |
68 | 89 | owner: context.repo.owner, |
69 | 90 | repo: context.repo.repo, |
70 | | - sha: '${{ inputs.head_sha }}', |
| 91 | + sha: process.env.HEAD_SHA, |
71 | 92 | state: 'success', |
72 | 93 | context: 'dependency-wheel-promotion', |
73 | 94 | description: 'Wheels promoted to stable storage.', |
74 | 95 | target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, |
75 | 96 | }); |
76 | 97 |
|
77 | | - - name: Post success comment |
78 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 98 | + - name: Update lifecycle comment (success) |
| 99 | + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 |
79 | 100 | with: |
80 | | - script: | |
81 | | - const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; |
82 | | - await github.rest.issues.createComment({ |
83 | | - owner: context.repo.owner, |
84 | | - repo: context.repo.repo, |
85 | | - issue_number: ${{ inputs.pr_number }}, |
86 | | - body: `Wheels promoted to stable storage for commit ${{ inputs.head_sha }} by @${context.actor}. [Workflow run](${runUrl}).`, |
87 | | - }); |
| 101 | + issue-number: ${{ inputs.pr_number }} |
| 102 | + comment-id: ${{ steps.started_comment.outputs.comment-id }} |
| 103 | + edit-mode: replace |
| 104 | + body: | |
| 105 | + <!-- dependency-wheel-promotion pr=${{ inputs.pr_number }} sha=${{ inputs.head_sha }} --> |
| 106 | + Wheels promoted to stable storage for commit `${{ inputs.head_sha }}` by @${{ github.actor }}. |
| 107 | + Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
88 | 108 |
|
89 | 109 | - name: Set dependency-wheel-promotion status to error |
90 | 110 | if: failure() |
91 | 111 | uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
| 112 | + env: |
| 113 | + HEAD_SHA: ${{ inputs.head_sha }} |
92 | 114 | with: |
93 | 115 | script: | |
94 | 116 | await github.rest.repos.createCommitStatus({ |
95 | 117 | owner: context.repo.owner, |
96 | 118 | repo: context.repo.repo, |
97 | | - sha: '${{ inputs.head_sha }}', |
| 119 | + sha: process.env.HEAD_SHA, |
98 | 120 | state: 'error', |
99 | 121 | context: 'dependency-wheel-promotion', |
100 | 122 | description: 'Wheel promotion failed. Check the Actions tab for details.', |
101 | 123 | target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, |
102 | 124 | }); |
| 125 | +
|
| 126 | + - name: Update lifecycle comment (failure) |
| 127 | + if: failure() |
| 128 | + uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0 |
| 129 | + with: |
| 130 | + issue-number: ${{ inputs.pr_number }} |
| 131 | + comment-id: ${{ steps.started_comment.outputs.comment-id }} |
| 132 | + edit-mode: replace |
| 133 | + body: | |
| 134 | + <!-- dependency-wheel-promotion pr=${{ inputs.pr_number }} sha=${{ inputs.head_sha }} --> |
| 135 | + Wheel promotion failed for commit `${{ inputs.head_sha }}` by @${{ github.actor }}. |
| 136 | + Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 137 | + Check the workflow logs before retrying. |
0 commit comments