13
13
DEFAULT_DEPLOYMENT_PREFIX : " main"
14
14
DEFAULT_NOTES : " "
15
15
DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD : " false"
16
- DEFAULT_REF : next
17
16
18
17
on :
19
18
schedule :
22
21
23
22
workflow_dispatch :
24
23
inputs :
25
- ref :
26
- description : " Branch to deploy (default: next)"
27
- required : false
28
-
29
24
notes :
30
25
description : " Notes"
31
26
required : false
@@ -67,19 +62,20 @@ permissions:
67
62
jobs :
68
63
trigger :
69
64
runs-on : ubuntu-latest
70
- if : ${{ github.repository == 'mdn/yari' && github.event.schedule != '' }}
65
+
66
+ # When run from `main` branch (schedule or manual), trigger workflow on `next` branch instead.
67
+ if : ${{ github.repository == 'mdn/yari' && github.ref_name == 'main' }}
71
68
steps :
72
- # The schedule runs the `main` version, but we want the `next` version.
73
- - run : gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "${{ env.DEFAULT_REF }}"
69
+ - run : gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "next"
74
70
env :
75
71
GH_TOKEN : ${{ secrets.AUTOMERGE_TOKEN }}
76
72
77
73
build :
78
74
environment : stage
79
75
runs-on : ubuntu-latest
80
76
81
- # Only run the scheduled workflows on the main repo .
82
- if : ${{ github.repository == 'mdn/yari' && github.event.schedule == '' }}
77
+ # We only ever want to deploy the `next` branch to stage .
78
+ if : ${{ github.repository == 'mdn/yari' && github.ref_name == 'next ' }}
83
79
84
80
steps :
85
81
# Our usecase is a bit complicated. When the cron schedule runs this workflow,
@@ -93,15 +89,12 @@ jobs:
93
89
run : |
94
90
echo "DEPLOYER_BUCKET_PREFIX=${{ github.event.inputs.deployment_prefix || env.DEFAULT_DEPLOYMENT_PREFIX }}" >> $GITHUB_ENV
95
91
echo "DEPLOYER_LOG_EACH_SUCCESSFUL_UPLOAD=${{ github.event.inputs.log_each_successful_upload || env.DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD }}" >> $GITHUB_ENV
96
- echo "REF=${{ github.event.inputs.ref || env.DEFAULT_REF }}" >> $GITHUB_ENV
97
92
98
93
- uses : actions/checkout@v4
99
94
with :
100
- ref : ${{ env.REF }}
101
95
fetch-depth : 0
102
96
103
97
- name : Merge main
104
- if : ${{ env.REF != 'main' }}
105
98
run : |
106
99
git config --global user.email "[email protected] "
107
100
git config --global user.name "mdn-bot"
0 commit comments