Skip to content

Commit e0ed199

Browse files
authored
Create rebase_workflow.yml
1 parent ac48a19 commit e0ed199

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Rebase workflow
4+
5+
# Controls when the workflow will run
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
prNumber:
10+
description: 'Corresponding pull request number'
11+
required: true
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "build"
16+
build:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
- name: Generate GitHub App token
23+
id: generate_token
24+
uses: tibdex/github-app-token@v1.3.0
25+
with:
26+
app_id: ${{ secrets.GMODNET_GITHUB_BOT_ID }}
27+
private_key: ${{ secrets.GMODNET_GITHUB_BOT_KEY }}
28+
29+
- name: Configere Git User information
30+
run: |
31+
git config --global user.name "GmodNET GitHub Bot"
32+
git config --global user.email support@gmodnet.xyz
33+
34+
- name: Checkout
35+
env:
36+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
37+
run: |
38+
gh repo clone ${{ github.repository }} ./
39+
gh pr checkout ${{ github.event.inputs.prNumber }}
40+
41+
- name: Extract branch name
42+
uses: nelonoel/branch-name@v1.0.1
43+
44+
- name: Rebase and push
45+
id: rebase_and_push
46+
continue-on-error: true
47+
run: |
48+
git rebase ${BRANCH_NAME}
49+
git push --force
50+
51+
- name: Notify if rebase was unsuccessful
52+
if: steps.rebase_and_push.outcome == 'failure'
53+
env:
54+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
55+
run: gh pr comment ${{ github.event.inputs.prNumber }} --body "Automatic rebase has failed. Manual rebase is required."

0 commit comments

Comments
 (0)