From 1f4b290696c511395b08e51820c9411fe6cc7c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Thu, 22 Oct 2026 13:28:43 +0200 Subject: [PATCH] ci: open a PR from the nightly example screenshots branch --- .github/workflows/example-screenshots-pr.yml | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/example-screenshots-pr.yml diff --git a/.github/workflows/example-screenshots-pr.yml b/.github/workflows/example-screenshots-pr.yml new file mode 100644 index 00000000..e77f6205 --- /dev/null +++ b/.github/workflows/example-screenshots-pr.yml @@ -0,0 +1,39 @@ +name: Example screenshots PR + +# rnmapbox/maps force-pushes this branch from its nightly doc screenshot capture, with a +# deploy key that can't open PRs. +on: + push: + branches: + - auto/example-screenshots + +permissions: + contents: read + pull-requests: write + +concurrency: + group: example-screenshots-pr + +jobs: + pr: + name: Open or update the example screenshots PR + runs-on: ubuntu-latest + steps: + - name: Open or update the PR + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + BRANCH: ${{ github.ref_name }} + MESSAGE: ${{ github.event.head_commit.message }} + run: | + TITLE=$(printf '%s\n' "$MESSAGE" | head -n 1) + { + echo "Example screenshots from the nightly capture in rnmapbox/maps that differ from main. This branch is rebuilt on top of main every night; the example pages use merged screenshots after the next docs update from rnmapbox/maps." + printf '%s\n' "$MESSAGE" | tail -n +2 + } > "$RUNNER_TEMP/body.md" + PR=$(gh pr list --head "$BRANCH" --base main --state open --json number --jq '.[0].number') + if [ -n "$PR" ]; then + gh pr edit "$PR" --title "$TITLE" --body-file "$RUNNER_TEMP/body.md" + else + gh pr create --head "$BRANCH" --base main --title "$TITLE" --body-file "$RUNNER_TEMP/body.md" + fi