Skip to content

Commit 6f34941

Browse files
committed
Refactor auto-labeling and auto-format workflows
1 parent ca14f63 commit 6f34941

File tree

2 files changed

+14
-44
lines changed

2 files changed

+14
-44
lines changed

.github/workflows/auto-format.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
actions: write
1010

1111
jobs:
12-
together:
12+
auto-format:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
@@ -64,4 +64,4 @@ jobs:
6464
if: steps.changes.outputs.has_changes == 'true'
6565
run: gh pr create -B main -H ${{ steps.branch.outputs.branch_name }} --title 'style:Run dotnet format' --body 'Created by Github Actions'
6666
env:
67-
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
67+
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}

.github/workflows/auto-labeling.yml

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,17 @@ on:
33
issues:
44
types:
55
- opened
6-
- reopened
76

8-
jobs:
9-
label_issue:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v4
14-
15-
- name: Get labels
16-
id: labels
17-
env:
18-
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
19-
run: |
20-
LABELS=$(gh label list --jq '.[].name' --json name | tr '\n' ',')
21-
echo "available_labels=$LABELS" >> $GITHUB_OUTPUT
22-
23-
- name: Install LangChain CLI
24-
run: |
25-
dotnet tool install --global langchain.cli --prerelease
26-
langchain auth openai ${{ secrets.OPENAI_API_KEY }} --model latest-smart
27-
28-
- name: Prepare prompt
29-
run: |
30-
echo "Return arguments for `gh issue edit $ISSUE_URL $ARGUMENTS_WILL_BE_HERE$` for issue with these data:" > prompt.txt
31-
echo "Title: ${{ github.event.issue.title }}" >> prompt.txt
32-
echo "Body: ${{ github.event.issue.body }}" >> prompt.txt
33-
echo "Available labels: ${{ steps.labels.outputs.available_labels }}" >> prompt.txt
34-
echo " " >> prompt.txt
35-
echo "IMPORTANT: Return ONLY replacement for $ARGUMENTS_WILL_BE_HERE$. It should contains one or more --add-label arguments" >> prompt.txt
36-
echo "Example output: --add-label \"vector databases\" --add-label \"enhancement\"" >> prompt.txt
37-
cat prompt.txt
7+
permissions:
8+
issues: write
389

39-
- name: Analyse issue
40-
id: analyse
41-
run: |
42-
ARGUMENTS=$(langchain generate --input-file prompt.txt)
43-
echo $ARGUMENTS
44-
echo "arguments=$ARGUMENTS" >> $GITHUB_OUTPUT
45-
46-
- env:
47-
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
48-
run: |
49-
gh issue edit ${{ github.event.issue.html_url }} ${{ steps.analyse.outputs.arguments }}
10+
jobs:
11+
auto-labeling:
12+
uses: oscoreio/ai-workflows/.github/workflows/auto-labeling.yml@main
13+
with:
14+
issue-number: ${{ github.event.issue.number }}
15+
model: free-fast
16+
provider: openrouter
17+
secrets:
18+
personal-access-token: ${{ secrets.PERSONAL_TOKEN }}
19+
openrouter-api-key: ${{ secrets.OPENROUTER_API_KEY_FOR_PRS }}

0 commit comments

Comments
 (0)