Generate files for project setup #15
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: Add generated files to commit | |
run: | | |
BRANCH_NAME="autocoder-branch-${{ github.event.issue.number }}" | |
git checkout -b "$BRANCH_NAME" | |
git add autocoder-bot/* # Add 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: | |
token: ${{ secrets.MY_PERSONAL_TOKEN }} | |
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" |