@@ -267,19 +267,57 @@ jobs:
267
267
issues : write
268
268
runs-on : ubuntu-latest
269
269
steps :
270
- - name : Post Comment on Issue # 6857
271
- if : github.event_name == 'schedule'
270
+ - id : issue-id
271
+ name : Determine GitHub Issue For Commenting
272
+ env :
273
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
274
+ run : |
275
+ set -euo pipefail
276
+ set -xv
277
+
278
+ # If this job was triggered by a pull request, then check to see if
279
+ # the description of the PR specifies a GitHub Issue to which to post
280
+ # a comment. The GitHub Issue number is specified by including a line
281
+ # of the form "trksmnkncd_notification_issue=6863" in the description.
282
+ # Specifying an issue number in this manner is primarily intended for
283
+ # debugging/development purposes of the comment-posting logic itself.
284
+ # For example, issue number 6863 was specifically created for testing.
285
+ # (see https://github.com/firebase/firebase-android-sdk/issues/6863)
286
+ readonly pr_number
287
+ pr_number=$(echo '${{ github.ref }}' | sed -En 's#^refs/pull/([0-9]+)/merge$#\1#p')
288
+ if [[ -n $pr_number ]] ; then
289
+ readonly issue_from_pr_body
290
+ issue_from_pr_body=$(gh issue view "$pr_number" --json body --jq '.body' | sed -En 's#(\s|^)trksmnkncd_notification_issue=([0-9]+)(\s|$)#\2#p')
291
+ fi
292
+
293
+ if [[ -v $issue_from_pr_body ]] && [[ -n $issue_from_pr_body ]] ; then
294
+ readonly issue="$issue_from_pr_body"
295
+ elif [[ '${{ github.event_name }}' == 'schedule' ]] ; then
296
+ # See https://github.com/firebase/firebase-android-sdk/issues/6857
297
+ readonly issue=6857
298
+ else
299
+ readonly issue=
300
+ fi
301
+
302
+ echo "issue=$issue" >> "$GITHUB_OUTPUT"
303
+
304
+ - name : Post Comment on GitHub Issue
305
+ if : steps.issue-id.outputs.issue != ''
272
306
env :
273
307
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
274
308
run : |
275
309
set -euo pipefail
276
310
277
311
cat >message.txt <<EOF
278
- Result of workflow ${{ github.workflow }} at ${{ github.ref }}: ${{ job.status }}
312
+ Result of workflows at ${{ github.sha }}:
313
+ - integration-test: ${{ (needs.integration-test.result == 'success' && '✅') || '❌' }} ${{ needs.integration-test.result }}
314
+ - actionlint-dataconnect-yml: ${{ (needs.actionlint-dataconnect-yml.result == 'success' && '✅') || '❌' }} ${{ needs.actionlint-dataconnect-yml.result }}
315
+
279
316
${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
280
- job=${{ github.job }} run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
317
+
318
+ run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
281
319
EOF
282
320
283
- echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/6857: "
321
+ echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/${{ steps.issue-id.outputs.issue }} "
284
322
cat message.txt
285
- gh issue comment 6857 --body-file message.txt -R ${{ github.repository }}
323
+ gh issue comment ${{ steps.issue-id.outputs.issue }} --body-file message.txt -R ${{ github.repository }}
0 commit comments