Skip to content

Sync mirrorz-help-ng #353

Sync mirrorz-help-ng

Sync mirrorz-help-ng #353

Workflow file for this run

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"
track_branch="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 -C "$transpiled_dir" fetch origin "+refs/heads/${track_branch}:refs/remotes/origin/${track_branch}" --depth=1
git -C "$transpiled_dir" checkout --force "origin/${track_branch}"
NEW_COMMIT=$(git -C "$transpiled_dir" rev-parse HEAD)
fi
NEW_COMMIT_SHORT=$(echo "$NEW_COMMIT" | cut -c1-8)
echo "NEW_COMMIT_SHORT=$NEW_COMMIT_SHORT" >> $GITHUB_ENV
echo -n "Update submodules to tuna/mirrorz-help-ng@$NEW_COMMIT" > /tmp/pr_msg
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: 'helpz: sync mirrorz-help-ng@${{ env.NEW_COMMIT_SHORT }}'
commit-message: 'helpz: sync tuna/mirrorz-help-ng@${{ env.NEW_COMMIT_SHORT }}'
author: 'GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>'
branch: helpz
delete-branch: true
body-path: /tmp/pr_msg