Sync Compatible Models #50
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 Compatible Models | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run daily | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download source file | |
run: | | |
mkdir -p content/guide/openstack/openagent | |
curl -o content/guide/openstack/openagent/compatible-models.mdx https://raw.githubusercontent.com/RSS3-Network/OpenAgent/docs/tests/compatible-models.mdx | |
- name: Check for changes | |
id: check | |
run: | | |
git add content/guide/openstack/openagent/compatible-models.mdx | |
if git diff --staged --quiet; then | |
echo "No changes detected" | |
echo "changes=false" >> $GITHUB_OUTPUT | |
echo "large_change=false" >> $GITHUB_OUTPUT | |
else | |
echo "Changes detected" | |
echo "changes=true" >> $GITHUB_OUTPUT | |
CHANGED_LINES=$(git diff --staged --numstat | awk '{total += $1 + $2} END {print total}') | |
if [ "$CHANGED_LINES" -gt 3 ]; then | |
echo "Large changes detected ($CHANGED_LINES lines)" | |
echo "large_change=true" >> $GITHUB_OUTPUT | |
else | |
echo "Small changes detected ($CHANGED_LINES lines)" | |
echo "large_change=false" >> $GITHUB_OUTPUT | |
fi | |
fi | |
# Create PR for large changes | |
- name: Create Pull Request | |
if: steps.check.outputs.changes == 'true' && steps.check.outputs.large_change == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: "chore: sync compatible models from upstream" | |
title: "chore: sync compatible models from upstream" | |
branch: sync-compatible-models | |
delete-branch: true | |
# Direct commit for small changes | |
- uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.check.outputs.changes == 'true' && steps.check.outputs.large_change == 'false' | |
with: | |
commit_message: "chore: sync compatible models from upstream" | |
branch: main |