Make the codebase robust #21
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: Deployment-Test | |
on: | |
workflow_call: | |
inputs: | |
issue_number: | |
required: true | |
type: number | |
issues: | |
types: [labeled] | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
jobs: | |
auto-fix: | |
if: github.event_name == 'workflow_call' || github.event.label.name == 'deploy-test' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Check required environment variables | |
env: | |
LLM_MODELS: ${{ secrets.LLM_MODELS }} | |
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | |
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | |
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |
PAT_USERNAME: ${{ secrets.PAT_USERNAME }} | |
run: | | |
required_vars=("LLM_MODELS" "LLM_API_KEY" "PAT_TOKEN" "PAT_USERNAME") | |
for var in "${required_vars[@]}"; do | |
if [ -z "${!var}" ]; then | |
echo "Error: Required environment variable $var is not set." | |
exit 1 | |
fi | |
done | |
- name: Set issue number and repo information | |
run: | | |
echo "ISSUE_NUMBER=${{ github.event.issue.number || inputs.issue_number }}" >> $GITHUB_ENV | |
echo "REPO_NAME=${{ github.repository }}" >> $GITHUB_ENV | |
- name: Comment on issue with start message | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: ${{ env.ISSUE_NUMBER }}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `You can monitor the progress [here](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).` | |
}); | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://github.com/JiseungHong/openhands-resolver.git | |
pip install firebase-admin | |
- name: Post Webpage Link to GitHub Issue | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issueNumber = ${{ env.ISSUE_NUMBER }}; | |
const repo = context.repo.repo | |
const owner = context.repo.owner | |
const firebaseWebpageURL = `https://pr-arena.web.app?id=${owner}_${repo}_${issueNumber}`; | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issueNumber, | |
body: `PR-Arena is now open! You can view the proposed fixes and make a decision at [this link](${firebaseWebpageURL}).` | |
}); | |
- name: Run Python script with Firebase config | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LLM_MODELS: ${{ secrets.LLM_MODELS }} | |
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | |
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | |
GITHUB_USERNAME: ${{ secrets.PAT_USERNAME }} | |
PYTHONPATH: "" | |
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} | |
run: | | |
cd /tmp && python -m openhands_resolver.test_firebase \ | |
--repo ${{ github.repository }} \ | |
--issue-number ${{ env.ISSUE_NUMBER }} |