Skip to content

Commit 334896b

Browse files
committed
refactor: Use centralized auto-update workflow from tryAGI/workflows
1 parent 76f3f83 commit 334896b

1 file changed

Lines changed: 5 additions & 62 deletions

File tree

.github/workflows/auto-update.yml

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,9 @@ on:
44
- cron: '0 */3 * * *'
55
workflow_dispatch:
66

7-
permissions:
8-
contents: write
9-
pull-requests: write
10-
actions: write
11-
127
jobs:
13-
check-openapi-updates:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v6
18-
19-
- name: Setup Git user
20-
run: |
21-
git config --local user.email "dependabot@bot.com"
22-
git config --local user.name "github-actions[bot]"
23-
24-
- name: Generate branch name
25-
id: branch
26-
run: echo "branch_name=bot/update-openapi_$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
27-
28-
- name: Create branch
29-
run: |
30-
git checkout -b ${{ steps.branch.outputs.branch_name }} origin/main
31-
git rebase main
32-
33-
- name: Setup .NET
34-
uses: actions/setup-dotnet@v5
35-
with:
36-
dotnet-version: 10.0.x
37-
38-
- name: Generate code
39-
run: |
40-
cd src/libs/AI21
41-
chmod +x ./generate.sh
42-
./generate.sh
43-
44-
- name: Check for changes
45-
id: changes
46-
run: |
47-
CHANGED=$(git diff --name-only)
48-
if [ -z "$CHANGED" ]; then
49-
echo "has_changes=false" >> $GITHUB_OUTPUT
50-
else
51-
echo "has_changes=true" >> $GITHUB_OUTPUT
52-
fi
53-
54-
- name: Push changes
55-
if: steps.changes.outputs.has_changes == 'true'
56-
run: |
57-
git add .
58-
git commit -m "feat: Updated OpenAPI spec"
59-
git push --force-with-lease -u origin ${{ steps.branch.outputs.branch_name }}
60-
61-
- name: Wait for 15 seconds
62-
if: steps.changes.outputs.has_changes == 'true'
63-
run: sleep 15
64-
65-
- name: Create pull request
66-
if: steps.changes.outputs.has_changes == 'true'
67-
run: gh pr create -B main -H ${{ steps.branch.outputs.branch_name }} --title 'feat:@coderabbitai' --body '@coderabbitai summary'
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
8+
auto-update:
9+
uses: tryAGI/workflows/.github/workflows/auto-update.yml@main
10+
with:
11+
library-path: src/libs/AI21
12+
secrets: inherit

0 commit comments

Comments
 (0)