Skip to content

Use gh tool with token #2

Use gh tool with token

Use gh tool with token #2

Workflow file for this run

name: Run Aider
on:
workflow_call:
secrets:
OPENAI_API_KEY:
description: 'OpenAI API key'
required: true
DOCKER_HUB_USERNAME:
description: 'Username for Docker Hub'
required: true
DOCKER_HUB_PASSWORD:
description: 'Password for Docker Hub'
required: true
GITHUB_TOKEN:

Check failure on line 15 in .github/workflows/run-agent.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/run-agent.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
description: 'GitHub token'
required: true
# Secrets are inherited and include OPENAI_API_KEY, DOCKER_HUB_USERNAME, and DOCKER_HUB_PASSWORD
jobs:
run-aider:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Run Aider from Docker container
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
docker run --rm -v ${{ github.workspace }}:/repo -e OPENAI_API_KEY bwehrle/aider-agent:0.1 healthcheck
# docker run --rm -v ${{ github.workspace }}:/repo -e OPENAI_API_KEY --entrypoint /bin/sh bwehrle/aider-agent:0.1 -c 'git log '
- name: Check if branch is dirty
id: check_dirty
run: |
echo $(git status -sb)
if [ -n "$(git status -sb)" ]; then
echo Found commits ahead of remote branch
echo "dirty=true" >> "$GITHUB_OUTPUT"
else
echo No commits ahead of remote branch
echo "dirty=false" >> "$GITHUB_OUTPUT"
fi
- name: Commit changes
if: steps.check_dirty.outputs.dirty == 'true'
run: |
git checkout -b $BRANCH
gh pr create -B main -H $BRANCH --title 'AI Agent PR ' --body 'Created by AI Agent'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ai-agent-${{ github.run_id }}