forked from adobecom/milo
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.21 KB
/
merge-to-stage.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
38
39
40
41
42
43
name: Merge to stage
on:
schedule:
- cron: '0 * * * *' # Run every hour
workflow_dispatch: # Allow manual trigger
pull_request:
types: [labeled] # Run when a label is added to a PR
env:
MILO_RELEASE_SLACK_WH: ${{ secrets.MILO_RELEASE_SLACK_WH }}
jobs:
merge-to-stage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Check label
id: check_label
uses: actions/[email protected]
with:
script: |
const fs = require('fs');
const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
const { label: { name } } = event;
return name === 'Ready for Stage';
}
return true;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge to stage or queue to merge
uses: actions/[email protected]
with:
script: |
const main = require('./.github/workflows/merge-to-stage.js')
main({ github, context, core })
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}