-
-
Notifications
You must be signed in to change notification settings - Fork 91
49 lines (43 loc) · 1.74 KB
/
auto-labeling.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Auto-labeling issue
on:
issues:
types:
- opened
- reopened
jobs:
label_issue:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get labels
id: labels
env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
LABELS=$(gh label list --jq '.[].name' --json name | tr '\n' ',')
echo "available_labels=$LABELS" >> $GITHUB_OUTPUT
- name: Install LangChain CLI
run: |
dotnet tool install --global langchain.cli --prerelease
langchain auth openai ${{ secrets.OPENAI_API_KEY }} --model gpt-4-turbo
- name: Prepare prompt
run: |
echo "Return arguments for `gh issue edit $ISSUE_URL $ARGUMENTS_WILL_BE_HERE$` for issue with these data:" > prompt.txt
echo "Title: ${{ github.event.issue.title }}" >> prompt.txt
echo "Body: ${{ github.event.issue.body }}" >> prompt.txt
echo "Available labels: ${{ steps.labels.outputs.available_labels }}" >> prompt.txt
echo " " >> prompt.txt
echo "IMPORTANT: Return ONLY replacement for $ARGUMENTS_WILL_BE_HERE$. It should contains one or more --add-label arguments" >> prompt.txt
echo "Example output: --add-label \"vector databases\" --add-label \"enhancement\"" >> prompt.txt
cat prompt.txt
- name: Analyse issue
id: analyse
run: |
ARGUMENTS=$(langchain generate --input-file prompt.txt)
echo $ARGUMENTS
echo "arguments=$ARGUMENTS" >> $GITHUB_OUTPUT
- env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
gh issue edit ${{ github.event.issue.html_url }} ${{ steps.analyse.outputs.arguments }}