Skip to content

Commit d92a470

Browse files
workflow
1 parent 2537f11 commit d92a470

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: Auto Merge Upstream and Publish
1+
2+
name: Auto Merge Upstream and Publish Operators
23

34
on:
5+
workflow_dispatch:
46
schedule:
57
- cron: '0 3 * * *'
6-
workflow_dispatch:
78

89
jobs:
910
merge-build-publish:
@@ -13,26 +14,38 @@ jobs:
1314
uses: actions/checkout@v4
1415
with:
1516
persist-credentials: false
17+
fetch-depth: 0
1618

17-
- name: Set up git
19+
- name: Set up git and fetch branches
1820
run: |
1921
git config user.name "github-actions[bot]"
2022
git config user.email "github-actions[bot]@users.noreply.github.com"
23+
git remote add upstream https://github.com/microsoft/TypeScript.git || true
24+
git fetch upstream
25+
git fetch origin operators
2126
22-
- name: Add upstream remote
23-
run: git remote add upstream https://github.com/microsoft/TypeScript.git
27+
- name: Merge upstream/main into main
28+
run: |
29+
git checkout main
30+
git merge upstream/main
2431
25-
- name: Fetch upstream
26-
run: git fetch upstream
32+
- name: Push merged changes to main
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: git push origin HEAD:main
2736

28-
- name: Merge upstream/main
29-
run: git merge upstream/main
37+
- name: Merge operators into main
38+
run: |
39+
git merge origin/operators
3040
31-
- name: Push changes
41+
- name: Push merged changes to operators
3242
env:
3343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3444
run: git push origin HEAD:operators
3545

46+
- name: Checkout operators branch
47+
run: git checkout operators
48+
3649
- name: Set up Node.js
3750
uses: actions/setup-node@v4
3851
with:
@@ -48,7 +61,9 @@ jobs:
4861
run: npx hereby LKG
4962

5063
- name: Publish to npm
51-
if: success() # Only publish if the previous steps were successful
64+
if: success()
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5267
run: |
5368
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
5469
npm publish --access public

0 commit comments

Comments
 (0)