Actions: automatically add comment on PR

This commit is contained in:
Pieter Vander Vennet 2025-03-03 01:21:06 +01:00
parent bfd6874516
commit 0f897306a0

View file

@ -62,5 +62,17 @@ jobs:
- name: unzipping remote file
run: ssh hetzner "cd /root/staging && rm -rf ${{ github.ref_name }} && unzip ${{ github.ref_name }}.zip && rm -rf /root/public/${{ github.ref_name }} && mv /root/staging/${{ github.ref_name }}/ /root/public/ && rm ${{ github.ref_name }}.zip"
- name: Extract PR number
run: echo "PR_NUMBER=$(echo $FORGEJO_REF_NAME | cut -d'/' -f3)" >> $FORGEJO_ENV
- name: add comment to PR
if: env.PR_NUMBER != ''
run: |
curl -X POST "https://source.mapcomplete.org/api/v1/repos/${FORGEJO_REPOSITORY}/issues/${PR_NUMBER}/comments" \
-H "Content-Type: application/json" \
-H "Authorization: token $FORGEJO_TOKEN" \
-d '{"body": "This PR has been deployed and is (temporarily) available on https://builds.mapcomplete.org/${PR_NUMBER}"}'
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}