Skip to content

Commit

Permalink
actions: trigger mirror-web update
Browse files Browse the repository at this point in the history
  • Loading branch information
shankerwangmiao committed Oct 31, 2023
1 parent 1b8d853 commit e87e06c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,38 @@ jobs:
python -m pip install --upgrade pip
pip install markdown pyyaml beautifulsoup4
- name: Build all documentation
id: build
run: |
export TUNA_TEMP_DIR=$(mktemp -d)
git worktree add --no-checkout --detach "$TUNA_TEMP_DIR" origin/transpiled
cat enabled.txt | xargs python global/compile.py -v --lang zh -C dom -C tuna
git -C "$TUNA_TEMP_DIR" add --all --verbose
if git -C "$TUNA_TEMP_DIR" diff --exit-code --quiet --cached; then
echo "No changes to commit."
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git -C "$TUNA_TEMP_DIR" \
-c user.name="GitHub Actions" \
-c user.email="github-actions[bot]@users.noreply.github.com" \
commit -m "Auto build for $GITHUB_REPOSITORY@${GITHUB_SHA::7}"
git -C "$TUNA_TEMP_DIR" push --force origin HEAD:transpiled
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "new_commit=$(git -C "$TUNA_TEMP_DIR" rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Trigger mirror-web update
uses: actions/github-script@v6
if: steps.build.outputs.changed == 'true'
env:
NEW_COMMIT: ${{ steps.build.outputs.new_commit }}
with:
github-token: ${{ secrets.MIRROR_WEB_TRIGGER_PAT }}
script: |
github.repos.createDispatchEvent({
owner: context.repo.owner,
repo: 'mirror-web',
workflow_id: 'sync-helpz.yml',
ref: 'master',
inputs: {
'new_commit': process.env.NEW_COMMIT,
},
});

0 comments on commit e87e06c

Please sign in to comment.