Generate files for project setup #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |