Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>pull/561/head
parent
ac196db6df
commit
028e687fbc
@ -0,0 +1,26 @@
|
|||||||
|
name: Automatic Rebase
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
jobs:
|
||||||
|
rebase:
|
||||||
|
name: Rebase
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: >-
|
||||||
|
github.event.issue.pull_request != '' &&
|
||||||
|
(
|
||||||
|
contains(github.event.comment.body, '/rebase') ||
|
||||||
|
contains(github.event.comment.body, '/autosquash')
|
||||||
|
)
|
||||||
|
steps:
|
||||||
|
- name: Checkout the latest code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||||
|
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||||
|
- name: Automatic Rebase
|
||||||
|
uses: cirrus-actions/rebase@1.8
|
||||||
|
with:
|
||||||
|
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
@ -0,0 +1,53 @@
|
|||||||
|
name: 'Github Rebot for Cherry Pick when PR is merged'
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
comment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Comment cherry-pick command
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
if (!pr.merged) {
|
||||||
|
console.log("PR is not merged. Skipping...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!pr.milestone || !pr.milestone.title) {
|
||||||
|
console.log("Milestone is not set. Skipping...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const milestone = pr.milestone.title;
|
||||||
|
const ref = `heads/release-${milestone}`;
|
||||||
|
let branchExists;
|
||||||
|
try {
|
||||||
|
await github.rest.git.getRef({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
ref: ref
|
||||||
|
});
|
||||||
|
branchExists = true;
|
||||||
|
} catch (error) {
|
||||||
|
if (error.status === 404) {
|
||||||
|
console.log(`Branch ${ref} does not exist. Skipping...`);
|
||||||
|
branchExists = false;
|
||||||
|
} else {
|
||||||
|
throw error; // Rethrow if it's another error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!branchExists) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cherryPickCmd = `/cherry-pick release-${milestone}`;
|
||||||
|
console.log(`Adding comment: ${cherryPickCmd}`);
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: pr.number,
|
||||||
|
body: cherryPickCmd
|
||||||
|
});
|
||||||
|
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
@ -0,0 +1,19 @@
|
|||||||
|
name: Github Rebot for Cherry Pick On Comment
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
jobs:
|
||||||
|
cherry-pick:
|
||||||
|
name: Cherry Pick
|
||||||
|
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cherry-pick') && github.event.comment.user.login=='kubbot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the latest code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||||
|
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||||
|
- name: Automatic Cherry Pick
|
||||||
|
uses: vendoo/gha-cherry-pick@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
Loading…
Reference in new issue