run-eval.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Run evaluation on a PR
  2. name: Run Eval
  3. # Runs when a PR is labeled with one of the "run-eval-" labels
  4. on:
  5. pull_request:
  6. types: [labeled]
  7. jobs:
  8. trigger-job:
  9. name: Trigger remote eval job
  10. if: ${{ github.event.label.name == 'run-eval-xs' || github.event.label.name == 'run-eval-s' || github.event.label.name == 'run-eval-m' }}
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout PR branch
  14. uses: actions/checkout@v3
  15. with:
  16. ref: ${{ github.head_ref }}
  17. - name: Trigger remote job
  18. run: |
  19. REPO_URL="https://github.com/${{ github.repository }}"
  20. PR_BRANCH="${{ github.head_ref }}"
  21. echo "Repository URL: $REPO_URL"
  22. echo "PR Branch: $PR_BRANCH"
  23. if [[ "${{ github.event.label.name }}" == "run-eval-xs" ]]; then
  24. EVAL_INSTANCES="1"
  25. elif [[ "${{ github.event.label.name }}" == "run-eval-s" ]]; then
  26. EVAL_INSTANCES="5"
  27. elif [[ "${{ github.event.label.name }}" == "run-eval-m" ]]; then
  28. EVAL_INSTANCES="30"
  29. fi
  30. curl -X POST \
  31. -H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" \
  32. -H "Accept: application/vnd.github+json" \
  33. -d "{\"ref\": \"main\", \"inputs\": {\"github-repo\": \"${REPO_URL}\", \"github-branch\": \"${PR_BRANCH}\", \"pr-number\": \"${{ github.event.pull_request.number }}\", \"eval-instances\": \"${EVAL_INSTANCES}\"}}" \
  34. https://api.github.com/repos/All-Hands-AI/evaluation/actions/workflows/create-branch.yml/dispatches
  35. # Send Slack message
  36. PR_URL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
  37. slack_text="PR $PR_URL has triggered evaluation on $EVAL_INSTANCES instances..."
  38. curl -X POST -H 'Content-type: application/json' --data '{"text":"'"$slack_text"'"}' \
  39. https://hooks.slack.com/services/${{ secrets.SLACK_TOKEN }}
  40. - name: Comment on PR
  41. uses: KeisukeYamashita/create-comment@v1
  42. with:
  43. unique: false
  44. comment: |
  45. Running evaluation on the PR. Once eval is done, the results will be posted.