Skip to content

Commit 56646b9

Browse files
authored
Create PR for tool spec changes (crewAIInc#364)
This commit fixes a bug where Actions tried to commit directly in main, and that is not allowed for this repo. It fixes it by creating PRs.
1 parent 8e4a411 commit 56646b9

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/generate-tool-specs.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
name: Generate Tool Specifications
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
78

89
permissions:
910
contents: write
11+
pull-requests: write
1012

1113
jobs:
1214
generate-specs:
@@ -50,11 +52,26 @@ jobs:
5052
echo "specs_changed=true" >> $GITHUB_OUTPUT
5153
fi
5254
53-
- name: Commit and push if changed
55+
- name: Generate GitHub App token
5456
if: steps.check_changes.outputs.specs_changed == 'true'
55-
run: |
56-
git commit -m "Update tool specifications for $(git describe --tags --abbrev=0)"
57-
git push
57+
id: app-token
58+
uses: tibdex/github-app-token@v2
59+
with:
60+
app_id: ${{ secrets.CREWAI_RELEASE_TOOL_APP_ID }}
61+
private_key: ${{ secrets.CREWAI_RELEASE_TOOL_APP_PRIVATE_KEY }}
62+
63+
- name: Create Pull Request
64+
if: steps.check_changes.outputs.specs_changed == 'true'
65+
uses: peter-evans/create-pull-request@v7
66+
with:
67+
token: ${{ steps.app-token.outputs.token }}
68+
title: "Automatically update tool specifications"
69+
base: main
70+
branch: update-tool-specs
71+
commit-message: "Automatically update tool specifications"
72+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
73+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
74+
delete-branch: false
5875

5976
notify-api:
6077
needs: generate-specs

0 commit comments

Comments
 (0)