Skip to content

Commit 79947e0

Browse files
committed
ci: remove old deploy comments to keep pr clean
1 parent ce4880b commit 79947e0

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/azure-static-web-apps-polite-cliff-0173aa90f.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,21 @@ jobs:
2424
submodules: true
2525
lfs: false
2626
- name: Delete old deploy comments
27-
run: |
28-
$pr = "${{ github.event.pull_request.number }}"
29-
gh api repos/${{ github.repository }}/issues/$pr/comments `
30-
| ConvertFrom-Json `
31-
| Where-Object body -like 'Azure Static Web Apps: Your stage site is ready! Visit it here: *' `
32-
| ForEach-Object {
33-
gh api repos/${{ github.repository }}/issues/comments/$($_.id) -X DELETE
34-
}
35-
shell: pwsh
27+
if: github.event_name == 'pull_request'
28+
shell: bash
3629
env:
3730
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
run: |
32+
pr=${{ github.event.pull_request.number }}
33+
comments=$(gh api repos/${{ github.repository }}/issues/$pr/comments)
34+
echo "$comments" | jq -c '.[]' | while read -r comment; do
35+
body=$(echo "$comment" | jq -r '.body')
36+
id=$(echo "$comment" | jq -r '.id')
37+
if [[ "$body" == Azure\ Static\ Web\ Apps:* ]]; then
38+
echo "Deleting comment $id"
39+
gh api repos/${{ github.repository }}/issues/comments/$id -X DELETE
40+
fi
41+
done
3842
- name: Build and deploy to Azure static web apps
3943
id: builddeploy
4044
uses: Azure/static-web-apps-deploy@v1

0 commit comments

Comments
 (0)