Skip to content

Commit 020b893

Browse files
committed
work
1 parent 93c72c6 commit 020b893

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

.github/workflows/dataconnect.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,26 +235,48 @@ jobs:
235235
issues: write
236236
runs-on: ubuntu-latest
237237
steps:
238-
- name: Post Comment on Issue
239-
#if: github.event_name == 'schedule'
238+
- id: issue-id
239+
name: Determine GitHub Issue For Commenting
240240
env:
241241
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
242242
run: |
243243
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
244252
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
247257
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=
250259
fi
251260
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+
252270
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+
254275
${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
276+
255277
job=${{ github.job }} run_id=${{ github.run_id }} run_number=${{ github.run_number }} run_attempt=${{ github.run_attempt }}
256278
EOF
257279
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 }}"
259281
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

Comments
 (0)