Skip to content

Commit f364e8b

Browse files
committed
Split escape commit msg into step
1 parent 7366819 commit f364e8b

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/sync-dataset-json-changes-to-js-utils.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,16 @@ jobs:
6464
git config --global user.email "auto-sync@kudoai.com"
6565
git config --global user.signingkey "$GPG_PRIVATE_ID"
6666
67-
- name: Sync <dataset>.json → adamlui/js-utils/<dataset>
67+
- name: Escape commit message
6868
env:
6969
RAW_COMMIT_MSG: ${{ github.event.head_commit.message }}
70+
run: |
71+
dataset="${{ env.DATASET }}"
72+
msg="${RAW_COMMIT_MSG:-Update $dataset.json}"
73+
printf '%s\n' "$msg" > commit_msg.txt
74+
echo "↞ [auto-sync from https://github.com/adamlui/python-utils/tree/main/$dataset]" >> commit_msg.txt
75+
76+
- name: Sync <dataset>.json → adamlui/js-utils/<dataset>
7077
run: |
7178
dataset="${{ env.DATASET }}"
7279
echo "Syncing $dataset.json"
@@ -76,11 +83,8 @@ jobs:
7683
dest_dir="${GITHUB_WORKSPACE}/adamlui/js-utils/$dataset"
7784
mkdir -p "$dest_dir"
7885
cp -f "$src_file" "$dest_dir/$dataset.json"
79-
COMMIT_MSG="${RAW_COMMIT_MSG:-Update $dataset.json} ↞ [auto-sync from \
80-
https://github.com/adamlui/python-utils/tree/main/$dataset]"
81-
ESCAPED_MSG=$(printf '%q' "$COMMIT_MSG")
8286
cd "${GITHUB_WORKSPACE}/adamlui/js-utils"
8387
git add "$dataset/$dataset.json"
84-
git commit -n -m "$ESCAPED_MSG" || echo "Nothing to commit"
88+
git commit -n -F "${GITHUB_WORKSPACE}/commit_msg.txt" || echo "Nothing to commit"
8589
git pull --rebase
8690
git push

0 commit comments

Comments
 (0)