@@ -235,26 +235,48 @@ jobs:
235
235
issues : write
236
236
runs-on : ubuntu-latest
237
237
steps :
238
- - name : Post Comment on Issue
239
- # if: github.event_name == 'schedule'
238
+ - id : issue-id
239
+ name : Determine GitHub Issue For Commenting
240
240
env :
241
241
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
242
242
run : |
243
243
set -euo pipefail
244
+ set -xv
245
+
246
+ readonly pr_number
247
+ pr_number=$(echo '${{ github.ref }}' | sed -En 's#^refs/pull/([0-9]+)/merge$#\1#p')
248
+ if [[ -n $pr_number ]] ; then
249
+ readonly issue_from_pr_body
250
+ 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')
251
+ fi
244
252
245
- if [[ '${{ github.event_name }}' == 'schedule' ]] ; then
246
- readonly github_notification_issue=6857
253
+ if [[ -v $issue_from_pr_body ]] ; then
254
+ readonly issue="$issue_from_pr_body"
255
+ elif [[ '${{ github.event_name }}' == 'schedule' ]] ; then
256
+ readonly issue=6857
247
257
else
248
- # Use the "testing" issue for non-scheduled jobs to avoid spamming the other issue
249
- readonly github_notification_issue=6863
258
+ readonly issue=
250
259
fi
251
260
261
+ echo "issue=$issue" >> "$GITHUB_OUTPUT"
262
+
263
+ - name : Post Comment on GitHub Issue
264
+ if : steps.issue-id.outputs.issue != ''
265
+ env :
266
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
267
+ run : |
268
+ set -euo pipefail
269
+
252
270
cat >message.txt <<EOF
253
- Result of workflow ${{ github.workflow }} at ${{ github.ref }}: ${{ job.status }}
271
+ Result of workflows at ${{ github.sha }}:
272
+ - integration-test: ${{ (needs.integration-test.result == 'success' && '✅') || '❌' }} ${{ needs.integration-test.result }}
273
+ - actionlint-dataconnect-yml: ${{ (needs.actionlint-dataconnect-yml.result == 'success' && '✅') || '❌' }} ${{ needs.actionlint-dataconnect-yml.result }}
274
+
254
275
${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
276
+
255
277
job=${{ github.job }} run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
256
278
EOF
257
279
258
- echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/$github_notification_issue: "
280
+ echo "Posting comment on GitHub Issue: https://github.com/firebase/firebase-android-sdk/issues/${{ steps.issue-id.outputs.issue }} "
259
281
cat message.txt
260
- gh issue comment $github_notification_issue --body-file message.txt -R ${{ github.repository }}
282
+ gh issue comment ${{ steps.issue-id.outputs.issue }} --body-file message.txt -R ${{ github.repository }}
0 commit comments