mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 07:04:12 +08:00
When a collaborator makes a `@discoursebot backport` comment on a PR, this workflow will create matching PRs for the same change against each currently-supported version branch
52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: Backport
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
backport:
|
|
if: |
|
|
github.event.issue.pull_request &&
|
|
contains(github.event.comment.body, '@discoursebot backport') &&
|
|
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Add reaction to comment
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh api \
|
|
--method POST \
|
|
/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \
|
|
-f content='+1'
|
|
|
|
- name: Post start comment
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr comment ${{ github.event.issue.number }} \
|
|
--repo ${{ github.repository }} \
|
|
--body "Backport started. [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GH_PUSH_TOKEN }}
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "Discourse CI"
|
|
git config --global user.email "ci@ci.invalid"
|
|
|
|
- name: Perform backport
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
|
|
PR_NUMBER: ${{ github.event.issue.number }}
|
|
run: ruby script/backport.rb
|