From 9e4b60a0a514cad4c1ce76edab4927226708c758 Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Wed, 1 Nov 2023 02:25:07 +0800 Subject: [PATCH] actions: add input for sync helpz --- .github/workflows/sync-helpz.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-helpz.yml b/.github/workflows/sync-helpz.yml index 67fe4f4..79596a7 100644 --- a/.github/workflows/sync-helpz.yml +++ b/.github/workflows/sync-helpz.yml @@ -1,6 +1,12 @@ name: 'Sync mirrorz-help-ng' on: workflow_dispatch: + inputs: + new_commit: + description: 'New commit hash' + required: false + type: string + default: '' schedule: - cron: '33 22 * * *' # 06:33 AM in Asia/Shanghai (UTC+8) jobs: @@ -12,8 +18,15 @@ jobs: with: submodules: true - name: Sync submodule + env: + NEW_COMMIT: ${{ inputs.new_commit }} run: | - git submodule update --remote help/_posts/mirrorz-help-ng-transpiled + transpiled_dir="help/_posts/mirrorz-help-ng-transpiled" + if [ -n "$NEW_COMMIT" ]; then + git -C "$transpiled_dir" checkout "$NEW_COMMIT" + else + git submodule update --remote "$transpiled_dir" + fi echo -n 'See content changes in: ' > /tmp/pr_msg echo -n 'https://github.com/tuna/mirrorz-help-ng/compare/' >> /tmp/pr_msg git diff --submodule=diff | head -n1 | cut -c24-39 >> /tmp/pr_msg