Skip to content

Commit c1a3e11

Browse files
Refactor merge workflow to use reusable workflow call
1 parent e4b6c71 commit c1a3e11

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

.github/workflows/merge.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,5 @@ on:
1212
- '*/*/*/*.json' # dbs/iam/users/123.json
1313

1414
jobs:
15-
# Merge record data file to whole table data file
16-
merge-records:
17-
name: Merge records into table file (table file is modified, repo is dirty now)
18-
runs-on: ubuntu-latest
19-
20-
# concurrency:
21-
# group: merge
22-
# cancel-in-progress: true
23-
24-
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v2
27-
with:
28-
fetch-depth: 2 # `git diff-tree` (used in `@db-man/cli mergeUpdatedTables`) need to compare HEAD and HEAD~1, so need to fetch 2 commits
29-
30-
- name: Install Node.js
31-
uses: actions/setup-node@v1
32-
with:
33-
node-version: 16.x
34-
35-
# Merge updated record files (by SHA) to the table files
36-
# Only tables which has updated record files will be merged
37-
- name: Merge records to tables
38-
run: npx @db-man/cli mergeUpdatedTables $GITHUB_SHA
39-
40-
# Debug: check which table files are modified
41-
- name: git status
42-
run: |
43-
git status
44-
git diff
45-
# git pull # this will make sure local update to date
46-
47-
- name: Commit files
48-
run: |
49-
git config user.name "github-actions[bot]"
50-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
51-
git status
52-
git add .
53-
git status
54-
git commit -m "[CI] Merge records to table"
55-
56-
- name: Push changes
57-
uses: ad-m/github-push-action@master
58-
# when multiple jobs run at the same time, only last git push will sucess, then other pipelines will fail and send email.
59-
# to prevent get lots of email notification, use `continue-on-error` to make pipeline success even the git push failed.
60-
continue-on-error: true
61-
with:
62-
github_token: ${{ secrets.GITHUB_TOKEN }}
63-
branch: ${{ github.ref }}
15+
call-merge-reusable-workflow:
16+
uses: db-man/db-man/.github/workflows/merge-reusable-workflow.yml@main

0 commit comments

Comments
 (0)