From cf09f00472225ec059247bad52ded80e0dc1da75 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Tue, 14 Jul 2020 13:44:17 +0200 Subject: [PATCH] chore: don't repeat comments for expo preview --- .github/workflows/expo-preview.yml | 14 +++++++++++++- .github/workflows/versions.yml | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/expo-preview.yml b/.github/workflows/expo-preview.yml index 22540548..b7dafb3e 100644 --- a/.github/workflows/expo-preview.yml +++ b/.github/workflows/expo-preview.yml @@ -47,9 +47,21 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | + const body = 'The Expo app for the example from this branch is ready!\n\n[expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }})\n\n'; + + const comments = await github.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + }); + + if (comments.some(comment => comment.body === body)) { + return; + } + github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: 'The Expo app for the example from this branch is ready!\n\n[expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }})\n\n' + body }) diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index 4fe21e7b..21009928 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -1,7 +1,7 @@ name: Check versions on: issues: - types: [opened] + types: [opened, edited] jobs: check-versions: