Built chatgpt.js 3.0.0 #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync changes between English readmes in root + docs/ | |
on: | |
push: | |
branches: [main] | |
paths: | |
- README.md | |
- docs/README.md | |
jobs: | |
build: | |
if: (github.repository == 'KudoAI/chatgpt.js') && (github.event.commits[0].committer.username != 'kudo-sync-bot') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout KudoAI/chatgpt.js | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.REPO_SYNC_PAT }} | |
repository: KudoAI/chatgpt.js | |
path: KudoAI/chatgpt.js | |
fetch-depth: 2 | |
- name: Sync README.md between root & docs/ | |
id: sync_readmes | |
run: | | |
cd "${{ github.workspace }}/KudoAI/chatgpt.js" | |
root_readme_modified=$(git log -1 --format="%ct" -- "README.md") | |
docs_readme_modified=$(git log -1 --format="%ct" -- "docs/README.md") | |
if [ "$root_readme_modified" -gt "$docs_readme_modified" ] ; then cp -f "README.md" "docs/README.md" ; sync_src="root" | |
elif [ "$docs_readme_modified" -gt "$root_readme_modified" ] ; then cp -f "docs/README.md" "README.md" ; sync_src="docs" ; fi | |
# Store sync src for commit msg in next step | |
echo "sync_src=$sync_src" >> $GITHUB_OUTPUT | |
- name: Push to KudoAI/chatgpt.js | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
push_options: --force | |
add_options: --all | |
commit_user_email: [email protected] | |
commit_message: "${{ github.event.head_commit.message }} ↞ [auto-sync from `${{ steps.sync_readmes.outputs.sync_src }}`]" | |
file_pattern: "**" | |
repository: KudoAI/chatgpt.js |