From 8ad43742749a9b6e494fc2475adf10d73bb80c3a Mon Sep 17 00:00:00 2001 From: Julian Anderson Date: Wed, 25 Nov 2026 16:23:10 -0500 Subject: [PATCH] ci(docs/preview): Post comment to PR for preview deployments The if condition is designed to make a new comment only once per PR. It could probably use some further selectivity to only do this for specific changed files, but we can cross that bridge when we get to it. --- .forgejo/workflows/documentation.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.forgejo/workflows/documentation.yml b/.forgejo/workflows/documentation.yml index 241763263..3ed149245 100644 --- a/.forgejo/workflows/documentation.yml +++ b/.forgejo/workflows/documentation.yml @@ -81,3 +81,13 @@ jobs: --expires 14 \ --comment "${{ forgejo.sha }}" \ --verbose + + - name: Post comment to PR + if: github.ref != 'refs/heads/main' && forgejo.event.name == 'pull_request' + run: | + if curl -s ${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/issues/${{ forgejo.event.number }}/comments | grep -qv 'PR-PREVIEW-MARKER'; then + echo -n 'Posting comment: ' + curl -s -X POST ${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/issues/${{ forgejo.event.number }}/comments \ + -H 'Authorization: token ${{ forgejo.token }}' \ + --json '{"body":"Preview ready: https://preview.continuwuity.org/@${{ forgejo.event.number }}/"}' + fi