generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 168
37 lines (31 loc) · 1.26 KB
/
merge-to-main.yaml
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
36
37
name: Merge to main
on:
pull_request:
types: [labeled]
schedule:
- cron: '0 9 * * *' # Run every day at 9am UTC
workflow_dispatch: # Allow manual trigger
env:
MILO_RELEASE_SLACK_WH: ${{ secrets.MILO_RELEASE_SLACK_WH }}
jobs:
merge-to-main:
runs-on: ubuntu-latest
environment: milo_pr_merge
# Run this when manually triggered or on a schedule
# Otherwise run this only on PRs that are merged from stage to main
if: github.repository_owner == 'adobecom' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref == 'stage'))
steps:
- uses: actions/create-github-app-token@v1
id: milo-pr-merge-token
with:
app-id: ${{ secrets.MILO_PR_MERGE_APP_ID }}
private-key: ${{ secrets.MILO_PR_MERGE_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Merge to main
uses: actions/github-script@v7
with:
github-token: ${{ steps.milo-pr-merge-token.outputs.token }}
script: |
const main = require('./.github/workflows/merge-to-main.js')
main({ github, context })