Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/auto-fix-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Construct Prompt
id: prompt
uses: actions/github-script@v7
Expand Down Expand Up @@ -90,12 +92,11 @@ jobs:
2. **Fix**: Implement the changes necessary to resolve the issue.
3. **Verify**: Ensure the code is correct and follows existing patterns.
4. **Output**: Do not output the diff. Provide a brief summary of what you changed.
5. **Safety**: Do not run \`gh\` commands or call the GitHub API directly. This workflow applies GitHub writes in trusted post-processing steps.
`;
core.setOutput('prompt', prompt);
- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down Expand Up @@ -128,6 +129,7 @@ jobs:
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "Fix for Issue #$ISSUE_NUMBER"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push origin "$BRANCH_NAME" --force

# Create PR
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/daily-issue-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Fetch Issues
id: fetch_issues
env:
Expand Down Expand Up @@ -119,8 +121,6 @@ jobs:
- name: Run Oz Agent
if: steps.fetch_issues.outputs.has_issues == 'true'
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fix-failing-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
with:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
persist-credentials: false
- name: Get Failure Logs
id: logs
env:
Expand Down Expand Up @@ -132,8 +133,6 @@ jobs:
core.setOutput('prompt', prompt);
- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down Expand Up @@ -177,6 +176,7 @@ jobs:
git checkout -b "$FIX_BRANCH"
git add .
git commit -m "Fix failing checks for run $RUN_ID"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push origin "$FIX_BRANCH" --force

# Find associated PR
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/respond-to-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
steps:
- name: Checkout Action
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Acknowledge Comment
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -154,13 +156,12 @@ jobs:
6. Format your response in Markdown.
7. Your output will be posted as a reply to the user.
8. Do not attempt to stage or commit changes. This happens automatically after you complete your response.
9. Do not run \`gh\` commands or call the GitHub API directly. This workflow handles GitHub writes in trusted post-processing steps.
`;

core.setOutput('prompt', prompt);
- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand All @@ -181,6 +182,7 @@ jobs:
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Oz Agent: Address comment"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push
else
echo "No changes to commit."
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/review-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the "Checkout PR" step here to use the token to fetch as is the case with the other workflows?

- name: Checkout PR
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -257,8 +258,6 @@ jobs:
core.setOutput('prompt', prompt);
- name: Run Oz Agent Review
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
with:
prompt: ${{ steps.prompt.outputs.prompt }}
warp_api_key: ${{ secrets.WARP_API_KEY }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/suggest-review-fixes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Fetch review comments
uses: actions/github-script@v7
with:
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Each scenario is provided in three forms:
and calls the reusable workflow via `jobs.<id>.uses`. These templates are intended to be copied
into `.github/workflows/` in your own repository and customized.

Security note: in these examples, the Oz Agent step is intentionally run without direct GitHub
authentication, and all GitHub write operations are handled in explicit post-processing steps. This
reduces prompt-injection blast radius while preserving automation.

### How to use the scenario workflows

1. Pick a scenario below (e.g., Respond to Comment, Auto Fix Issue).
Expand Down Expand Up @@ -137,7 +141,7 @@ _Consumer Template_: [consumer-workflows/review-pr.yml](consumer-workflows/revie
**Setup:**

- Ensure `WARP_API_KEY` is set in Repository Secrets.
- The Agent needs read access to contents and write access to pull-requests.
- Workflow requires read access to contents and write access to pull-requests.

**Expected Output:**

Expand Down Expand Up @@ -230,7 +234,7 @@ style), the Agent replies with a code suggestion block containing the fix.
**Setup:**

- Ensure `WARP_API_KEY` is set in Repository Secrets.
- Action requires write permissions for `contents` and `pull-requests`.
- Workflow requires `contents: read` and `pull-requests: write`.

**Expected Output:**

Expand Down
2 changes: 1 addition & 1 deletion consumer-workflows/review-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
# Setup:
# - Ensure WARP_API_KEY is set in Repository Secrets.
# - The Agent needs read access to contents and write access to pull-requests.
# - Workflow requires read access to contents and write access to pull-requests.
#
# Expected Output:
# - Inline comments on the PR diff highlighting potential bugs, security issues, or style improvements.
Expand Down
6 changes: 4 additions & 2 deletions examples/auto-fix-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Construct Prompt
id: prompt
Expand Down Expand Up @@ -83,13 +85,12 @@ jobs:
2. **Fix**: Implement the changes necessary to resolve the issue.
3. **Verify**: Ensure the code is correct and follows existing patterns.
4. **Output**: Do not output the diff. Provide a brief summary of what you changed.
5. **Safety**: Do not run \`gh\` commands or call the GitHub API directly. This workflow applies GitHub writes in trusted post-processing steps.
`;
core.setOutput('prompt', prompt);

- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down Expand Up @@ -120,6 +121,7 @@ jobs:
git checkout -b "$BRANCH_NAME"
git add .
git commit -m "Fix for Issue #$ISSUE_NUMBER"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push origin "$BRANCH_NAME" --force

# Create PR
Expand Down
4 changes: 2 additions & 2 deletions examples/daily-issue-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Fetch Issues
id: fetch_issues
Expand Down Expand Up @@ -111,8 +113,6 @@ jobs:
- name: Run Oz Agent
if: steps.fetch_issues.outputs.has_issues == 'true'
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down
4 changes: 2 additions & 2 deletions examples/fix-failing-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
with:
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
persist-credentials: false

- name: Get Failure Logs
id: logs
Expand Down Expand Up @@ -129,8 +130,6 @@ jobs:

- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand Down Expand Up @@ -172,6 +171,7 @@ jobs:
git checkout -b "$FIX_BRANCH"
git add .
git commit -m "Fix failing checks for run $RUN_ID"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push origin "$FIX_BRANCH" --force

# Find associated PR
Expand Down
6 changes: 4 additions & 2 deletions examples/respond-to-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
steps:
- name: Checkout Action
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Acknowledge Comment
env:
Expand Down Expand Up @@ -148,14 +150,13 @@ jobs:
6. Format your response in Markdown.
7. Your output will be posted as a reply to the user.
8. Do not attempt to stage or commit changes. This happens automatically after you complete your response.
9. Do not run \`gh\` commands or call the GitHub API directly. This workflow handles GitHub writes in trusted post-processing steps.
`;

core.setOutput('prompt', prompt);

- name: Run Oz Agent
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
id: agent
with:
prompt: ${{ steps.prompt.outputs.prompt }}
Expand All @@ -174,6 +175,7 @@ jobs:
if [[ -n $(git status --porcelain) ]]; then
git add .
git commit -m "Oz Agent: Address comment"
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
git push
else
echo "No changes to commit."
Expand Down
7 changes: 3 additions & 4 deletions examples/review-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Setup:
# - Ensure WARP_API_KEY is set in Repository Secrets.
# - The Agent needs read access to contents and write access to pull-requests.
# - Workflow requires read access to contents and write access to pull-requests.
#
# Expected Output:
# - Inline comments on the PR diff highlighting potential bugs, security issues, or style improvements.
Expand All @@ -28,10 +28,11 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Checkout PR
env:
Expand Down Expand Up @@ -250,8 +251,6 @@ jobs:

- name: Run Oz Agent Review
uses: warpdotdev/oz-agent-action@v1
env:
GH_TOKEN: ${{ github.token }}
with:
prompt: ${{ steps.prompt.outputs.prompt }}
warp_api_key: ${{ secrets.WARP_API_KEY }}
Expand Down
3 changes: 2 additions & 1 deletion examples/suggest-review-fixes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ jobs:
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Fetch review comments
uses: actions/github-script@v7
Expand Down