|
6 | 6 | paths: ['lib/**'] |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - sync: |
10 | | - uses: agent-sh/.github/.github/workflows/sync-core.yml@main |
11 | | - with: |
12 | | - source-repo: agent-sh/agent-core |
13 | | - target-repos: '["agentsys"]' |
14 | | - lib-path: lib |
15 | | - secrets: |
16 | | - SYNC_TOKEN: ${{ secrets.SYNC_TOKEN }} |
| 9 | + sync-agentsys: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout agent-core |
| 13 | + uses: actions/checkout@v4 |
| 14 | + with: |
| 15 | + path: source |
| 16 | + |
| 17 | + - name: Checkout agentsys |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + repository: agent-sh/agentsys |
| 21 | + token: ${{ secrets.SYNC_TOKEN }} |
| 22 | + path: target |
| 23 | + |
| 24 | + - name: Sync lib |
| 25 | + run: | |
| 26 | + rm -rf target/lib/ |
| 27 | + cp -r source/lib/ target/lib/ |
| 28 | +
|
| 29 | + - name: Check for changes |
| 30 | + id: diff |
| 31 | + working-directory: target |
| 32 | + run: | |
| 33 | + git diff --quiet && echo "changed=false" >> $GITHUB_OUTPUT || echo "changed=true" >> $GITHUB_OUTPUT |
| 34 | +
|
| 35 | + - name: Create PR |
| 36 | + if: steps.diff.outputs.changed == 'true' |
| 37 | + working-directory: target |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ secrets.SYNC_TOKEN }} |
| 40 | + run: | |
| 41 | + BRANCH="chore/sync-core-$(date +%Y%m%d-%H%M%S)" |
| 42 | + git config user.name "agent-core-bot" |
| 43 | + git config user.email "noreply@agent-sh.github.io" |
| 44 | + git checkout -b "$BRANCH" |
| 45 | + git add lib/ |
| 46 | + git commit -m "chore: sync core lib from agent-core" |
| 47 | + git push origin "$BRANCH" |
| 48 | + gh pr create \ |
| 49 | + --repo agent-sh/agentsys \ |
| 50 | + --title "chore: sync core lib from agent-core" \ |
| 51 | + --body "Automated sync of lib/ from [agent-core](https://github.com/agent-sh/agent-core)." \ |
| 52 | + --head "$BRANCH" |
0 commit comments