Generate files for project setup #28
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: 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: Add generated files to commit | |
run: | | |
BRANCH_NAME="autocoder-branch-${{ github.event.issue.number }}" | |
git checkout -b "$BRANCH_NAME" | |
git add autocoder-bot/* # Добавляем явно все файлы из autocoder-bot/ | |
git status # Проверяем, что файлы добавлены в индекс | |
git commit --author="autocoder-bot <[email protected]>" -m "Generated code for issue #${{ github.event.issue.number }}" | |
git push origin "$BRANCH_NAME" | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_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" | |
committer: autocoder-bot <[email protected]> |