@@ -6,18 +6,26 @@ permissions:
66 contents : read
77
88on :
9+ pull_request :
10+ types :
11+ - opened
12+ - reopened
13+ - labeled
14+ - synchronize
915 pull_request_target :
1016 types :
1117 - labeled
1218 - synchronize
1319
1420concurrency :
15- group : ${{ github.workflow }}-${{ github.ref }}-${{ github. event.number }}
21+ group : ${{ github.workflow }}-${{ github.event.pull_request .number }}
1622 cancel-in-progress : true
1723
1824jobs :
1925 comment-if-missing-label :
26+ if : github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && github.actor != 'github-actions[bot]')
2027 runs-on : ubuntu-latest
28+
2129 steps :
2230 - name : Checkout PR branch
2331 uses : actions/checkout@v4
3240 git fetch origin ${{ github.event.pull_request.head.sha }} --depth=1
3341
3442 if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
35- | grep -E '^examples/(deepspeed|torchtune)/'; then
43+ | grep -E '^examples/(deepspeed|torchtune)/' >/dev/null ; then
3644 echo "found_changes=true" >> $GITHUB_OUTPUT
3745 else
3846 echo "found_changes=false" >> $GITHUB_OUTPUT
5159 const hasLabel = labels.some(l => l.name === 'ok-to-test-gpu-runner');
5260 core.setOutput('has_label', hasLabel ? 'true' : 'false');
5361
62+ - name : Check if comment already exists
63+ id : comment-exists
64+ uses : actions/github-script@v7
65+ with :
66+ script : |
67+ const { data: comments } = await github.rest.issues.listComments({
68+ owner: context.repo.owner,
69+ repo: context.repo.repo,
70+ issue_number: context.issue.number
71+ });
72+ const botCommentExists = comments.some(c =>
73+ c.user.type === 'Bot' &&
74+ c.body.includes('ok-to-test-gpu-runner')
75+ );
76+ core.setOutput('exists', botCommentExists ? 'true' : 'false');
77+
5478 - name : Post comment requesting label
55- if : steps.changes.outputs.found_changes == 'true' && steps.label-check.outputs.has_label == 'false'
79+ if : steps.changes.outputs.found_changes == 'true' && steps.label-check.outputs.has_label == 'false' && steps.comment-exists.outputs.exists == 'false'
5680 uses : actions/github-script@v7
5781 with :
5882 script : |
6387 body: `Hello @andreyvelich @varodrig @jaiakash 👋,
6488 Changes were detected in the LLM blueprint directories (\`examples/deepspeed\` or \`examples/torchtune\`).
6589 To run the test on GPU infra, please add the **ok-to-test-gpu-runner** label to this PR.`
66- });
90+ });
0 commit comments