[Sync to prerelease] added mastodon-comments extension #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Port change to prerelease | |
on: | |
pull_request_target: | |
types: [closed] | |
permissions: | |
contents: write # so it can comment | |
pull-requests: write # so it can create pull requests | |
checks: write # so it can create a check run | |
jobs: | |
sync-to-prerelease: | |
name: Backport pull request | |
runs-on: ubuntu-latest | |
# Don't run on closed unmerged pull requests and only PRs to main | |
if: github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' | |
outputs: | |
pr-created: ${{ steps.synced-pr.outputs.was_successful }} | |
pr-number: ${{ steps.synced-pr.outputs.created_pull_numbers }} | |
pr-sha: ${{ steps.new-pr-info.outputs.sha }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create backport pull requests | |
id: synced-pr | |
# https://github.com/korthout/backport-action/releases/tag/v3.0.0 | |
uses: korthout/backport-action@7e7cb1977d64d20339e8fdec12c0a1a065371de7 | |
with: | |
cherry_picking: auto | |
branch_name: sync-${pull_number}-to-${target_branch} | |
merge_commits: skip | |
pull_title: '[Sync to ${target_branch}] ${pull_title}' | |
pull_description: | | |
# Description | |
Sync of #${pull_number} to `${target_branch}`. | |
## Original PR | |
### ${pull_title} | |
${pull_description} | |
# Don't trigger on labels, and always PR to prerelease | |
label_pattern: '' | |
target_branches: prerelease | |
- name: New PR info | |
id: new-pr-info | |
if: steps.synced-pr.outputs.was_successful == 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "sha=$(gh api /repos/quarto-dev/quarto-web/pulls/${{ steps.synced-pr.outputs.created_pull_numbers }} -q '.head.sha')" >> "$GITHUB_OUTPUT" | |
shell: bash | |
- name: "Create a check run on the new PR" | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head_sha: "${{ steps.new-pr-info.outputs.sha }}", | |
name: "Deploying preview", | |
status: "in_progress", | |
}); | |
# Trigger the preview workflow if a new PR was created | |
# because PR created from bot does not trigger pull_request workflow | |
publish-changes-prerelease: | |
needs: [ sync-to-prerelease ] | |
if: ${{ needs.sync-to-prerelease.outputs.pr-created == 'true' }} | |
uses: ./.github/workflows/preview.yml | |
with: | |
pr-number: ${{ needs.sync-to-prerelease.outputs.pr-number }} | |
prerelease: true | |
secrets: inherit | |
# This update the status check on the PR to completed | |
update-status: | |
needs: [sync-to-prerelease, publish-changes-prerelease] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Create a check run on the new PR" | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
await github.rest.checks.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head_sha: "${{ needs.sync-to-prerelease.outputs.pr-sha }}", | |
name: "Deploying preview", | |
status: "completed", | |
conclusion: "${{ needs.publish-changes-prerelease.result }}" | |
}); |