Skip to content

Commit

Permalink
Name var for what it does for us (#5645)
Browse files Browse the repository at this point in the history
  • Loading branch information
enyst authored Dec 17, 2024
1 parent 90aac27 commit f90d2c0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/openhands-resolver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ jobs:
uses: actions/github-script@v7
if: always()
env:
CONDITIONAL_EXECUTED: ${{ env.CONDITIONAL_EXECUTED || 'false' }}
AGENT_RESPONDED: ${{ env.AGENT_RESPONDED || 'false' }}
with:
github-token: ${{ secrets.PAT_TOKEN || github.token }}
script: |
Expand All @@ -277,23 +277,23 @@ jobs:
// Check logs from send_pull_request.py (pushes code to GitHub)
if (logContent.includes("Updated pull request")) {
console.log("Updated pull request found. Skipping comment.");
process.env.CONDITIONAL_EXECUTED = 'true';
process.env.AGENT_RESPONDED = 'true';
} else if (logContent.includes(noChangesMessage)) {
github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: `The workflow to fix this issue encountered an error. Openhands failed to create any code changes.`
});
process.env.CONDITIONAL_EXECUTED = 'true';
process.env.AGENT_RESPONDED = 'true';
}
# Step leaves comment for when agent is invoked on issue
- name: Comment on issue # Comment link to either PR or branch created by agent
uses: actions/github-script@v7
if: always() # Comment on issue even if the previous steps fail
env:
CONDITIONAL_EXECUTED: ${{ env.CONDITIONAL_EXECUTED || 'false' }}
AGENT_RESPONDED: ${{ env.AGENT_RESPONDED || 'false' }}
with:
github-token: ${{ secrets.PAT_TOKEN || github.token }}
script: |
Expand Down Expand Up @@ -323,21 +323,21 @@ jobs:
repo: context.repo.repo,
body: `A potential fix has been generated and a draft PR #${prNumber} has been created. Please review the changes.`
});
process.env.CONDITIONAL_EXECUTED = 'true';
process.env.AGENT_RESPONDED = 'true';
} else if (!success && branchName) {
github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: `An attempt was made to automatically fix this issue, but it was unsuccessful. A branch named '${branchName}' has been created with the attempted changes. You can view the branch [here](https://github.com/${context.repo.owner}/${context.repo.repo}/tree/${branchName}). Manual intervention may be required.`
});
process.env.CONDITIONAL_EXECUTED = 'true';
process.env.AGENT_RESPONDED = 'true';
}
# Leave error comment when both PR/Issue comment handling fail
- name: Fallback Error Comment
uses: actions/github-script@v7
if: ${{ env.CONDITIONAL_EXECUTED == 'false' }} # Only run if no conditions were met in previous steps
if: ${{ env.AGENT_RESPONDED == 'false' }} # Only run if no conditions were met in previous steps
with:
github-token: ${{ secrets.PAT_TOKEN || github.token }}
script: |
Expand Down

0 comments on commit f90d2c0

Please sign in to comment.