-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (49 loc) · 1.81 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
60
name: Autocoder Workflow
on:
issues:
types: [opened, reopened, labeled]
permissions:
contents: write
pull-requests: write
jobs:
process_issue:
if: contains(github.event.issue.labels.*.name, 'autocoder-bot')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure git settings
run: |
git config user.name "autocoder-bot"
git config user.email "[email protected]"
- name: Debug File Location
run: ls -l ./scripts
- name: Make script executable
run: chmod +x ./scripts/script.sh
- name: Run the autocoder script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
./scripts/script.sh $GITHUB_TOKEN $REPOSITORY $ISSUE_NUMBER $OPENAI_API_KEY
- name: Debug Generated Files
run: ls -R autocoder-bot/
- name: Commit generated code
run: |
BRANCH_NAME="autocoder-branch-${{ github.event.issue.number }}"
git checkout -b "$BRANCH_NAME"
git add autocoder-bot/* # Make sure to stage all generated files
git commit -m "Generated code for issue #${{ github.event.issue.number }}"
git push origin "$BRANCH_NAME"
- name: Debug Git Status
run: git status
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: autocoder-branch-${{ github.event.issue.number }}
base: main
title: "Generated code for issue #${{ github.event.issue.number }}"
body: "This pull request contains the generated code."
labels: "autocoder-bot"