-
Notifications
You must be signed in to change notification settings - Fork 2
35 lines (31 loc) · 1.39 KB
/
global-smart-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "[Global] SPR"
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
# Mark PR as auto-mergeable if it's opened by known user
enable_auto_merge_for_known_users:
name: "[Global] Enable auto-merge for known users"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable auto-merge for known users
if: github.event.pull_request.user.login == 'AleksandarDev'
run: |
gh pr merge --merge --auto ${{ github.event.pull_request.number }}
gh pr comment ${{ github.event.pull_request.number }} --body "🪄 Auto-merge enabled for known user."
env:
GITHUB_TOKEN: ${{ secrets.AT_GH_CD_REPO_PAT }}
# Retarget to next branch if PR is opened against main (and head is not next)
retarget-feature-prs:
if: github.event_name == 'pull_request' && github.event.action == 'opened' && github.base_ref == 'main' && github.head_ref != 'next'
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@v4
- name: Change PR target
run: gh pr edit ${{ github.event.number }} --base next
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}