mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
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:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- name: Sync submodule
|
|
env:
|
|
NEW_COMMIT: ${{ inputs.new_commit }}
|
|
run: |
|
|
transpiled_dir="help/_posts/mirrorz-help-ng-transpiled"
|
|
if [ -n "$NEW_COMMIT" ]; then
|
|
git -C "$transpiled_dir" fetch origin "+$NEW_COMMIT:refs/remotes/origin/incoming" --depth=1
|
|
git -C "$transpiled_dir" checkout --force "$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
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
title: 'helpz: sync mirrorz-help-ng'
|
|
commit-message: 'helpz: sync mirrorz-help-ng'
|
|
author: 'GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>'
|
|
branch: helpz
|
|
delete-branch: true
|
|
body-path: /tmp/pr_msg
|