Some checks failed
Self-hosted runner (nightly-past-ci-caller) / Get number (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.11 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.10 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.9 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.8 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.7 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.6 (push) Has been cancelled
Self-hosted runner (nightly-past-ci-caller) / TensorFlow 2.5 (push) Has been cancelled
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
Build documentation / build (push) Has been cancelled
Build documentation / build_other_lang (push) Has been cancelled
CodeQL Security Analysis / CodeQL Analysis (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
PR CI / pr-ci (push) Has been cancelled
Slow tests on important models (on Push - A10) / Get all modified files (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
Slow tests on important models (on Push - A10) / Model CI (push) Has been cancelled
Check Tiny Models / Check tiny models (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Model CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Pipeline CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Example CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / DeepSpeed CI (push) Has been cancelled
Self-hosted runner (Intel Gaudi3 scheduled CI caller) / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI - Flash Attn / Setup (push) Has been cancelled
Nvidia CI - Flash Attn / Model CI (push) Has been cancelled
Nvidia CI / Setup (push) Has been cancelled
Nvidia CI / Model CI (push) Has been cancelled
Nvidia CI / Torch pipeline CI (push) Has been cancelled
Nvidia CI / Example CI (push) Has been cancelled
Nvidia CI / Trainer/FSDP CI (push) Has been cancelled
Nvidia CI / DeepSpeed CI (push) Has been cancelled
Nvidia CI / Quantization CI (push) Has been cancelled
Nvidia CI / Kernels CI (push) Has been cancelled
Doctests / Setup (push) Has been cancelled
Doctests / Call doctest jobs (push) Has been cancelled
Doctests / Send results to webhook (push) Has been cancelled
Extras Smoke Test / Get supported Python versions (push) Has been cancelled
Extras Smoke Test / Test extras on Python ${{ matrix.python-version }} (push) Has been cancelled
Extras Smoke Test / Check Slack token availability (push) Has been cancelled
Extras Smoke Test / Notify failures to Slack (push) Has been cancelled
Self-hosted runner (AMD scheduled CI caller) / Trigger Scheduled AMD CI (push) Has been cancelled
Stale Bot / Close Stale Issues (push) Has been cancelled
98 lines
3.4 KiB
YAML
98 lines
3.4 KiB
YAML
# This workflow allows trusted contributors to trigger TRL CI runs against
|
|
# specific Transformers commits by commenting `/trl-ci` on a PR in the TRL repo.
|
|
# It is meant to be used during the ongoing Trainer refactor/unbloat in Transformers,
|
|
# to help evaluate the downstream impact on TRL.
|
|
name: TRL CI bot
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
issues: read
|
|
|
|
jobs:
|
|
dispatch:
|
|
if: >
|
|
github.event.issue.pull_request &&
|
|
contains(github.event.comment.body, '/trl-ci')
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Gate on trusted commenter
|
|
id: trust
|
|
run: |
|
|
assoc="${{ github.event.comment.author_association }}"
|
|
case "$assoc" in
|
|
MEMBER|OWNER|COLLABORATOR) echo "trusted=true" >> $GITHUB_OUTPUT ;;
|
|
*) echo "trusted=false" >> $GITHUB_OUTPUT ;;
|
|
esac
|
|
|
|
- name: Reject untrusted commenter
|
|
if: steps.trust.outputs.trusted != 'true'
|
|
run: |
|
|
echo "::error::Untrusted commenter (${{ github.event.comment.author_association }}); aborting."
|
|
exit 1
|
|
|
|
- name: Fetch PR head SHA + number
|
|
if: steps.trust.outputs.trusted == 'true'
|
|
id: pr
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_URL: ${{ github.event.issue.pull_request.url }}
|
|
run: |
|
|
sha=$(gh api "$PR_URL" --jq .head.sha)
|
|
number=$(gh api "$PR_URL" --jq .number)
|
|
echo "sha=$sha" >> "$GITHUB_OUTPUT"
|
|
echo "number=$number" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Dispatch TRL workflow
|
|
if: steps.trust.outputs.trusted == 'true'
|
|
id: dispatch
|
|
env:
|
|
GH_TOKEN: ${{ secrets.TRL_CI_DISPATCH_TOKEN }}
|
|
STEPS_PR_OUTPUTS_SHA: ${{ steps.pr.outputs.sha }}
|
|
run: |
|
|
gh workflow run "Tests against Transformers branch" \
|
|
-R huggingface/trl \
|
|
-f transformers_ref=${STEPS_PR_OUTPUTS_SHA}
|
|
|
|
- name: Find TRL workflow run URL
|
|
if: steps.trust.outputs.trusted == 'true'
|
|
id: find_run
|
|
env:
|
|
GH_TOKEN: ${{ secrets.TRL_CI_DISPATCH_TOKEN }}
|
|
run: |
|
|
echo "Waiting for workflow to appear..."
|
|
for i in {1..10}; do
|
|
run_url=$(gh api \
|
|
repos/huggingface/trl/actions/workflows \
|
|
--jq '.workflows[] | select(.name=="Tests against Transformers branch") | .id')
|
|
|
|
if [ -n "$run_url" ]; then
|
|
run=$(gh api \
|
|
repos/huggingface/trl/actions/workflows/$run_url/runs \
|
|
-f event=workflow_dispatch \
|
|
-f per_page=5 \
|
|
--jq '.workflow_runs[0].html_url')
|
|
if [ -n "$run" ]; then
|
|
echo "url=$run" >> $GITHUB_OUTPUT
|
|
break
|
|
fi
|
|
fi
|
|
sleep 5
|
|
done
|
|
|
|
- name: Comment back on PR with link
|
|
if: steps.trust.outputs.trusted == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
STEPS_PR_OUTPUTS_SHA: ${{ steps.pr.outputs.sha }}
|
|
STEPS_FIND_RUN_OUTPUTS_URL: ${{ steps.find_run.outputs.url }}
|
|
run: |
|
|
gh api -X POST \
|
|
/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
|
|
-f body="🚀 **TRL CI triggered** against transformers commit \`${STEPS_PR_OUTPUTS_SHA}\`\n\n🔗 **Run:** ${STEPS_FIND_RUN_OUTPUTS_URL}"
|