[HUDI-7438][Test][DNM] Fix Azure CI report check with new issue comments #6147
Workflow file for this run
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: Label PR | |
on: | |
pull_request: | |
types: [ opened, edited, reopened, synchronize ] | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
labeler: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Label PR size | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const prNumber = context.payload.pull_request.number; | |
const { data: prData } = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: prNumber, | |
}); | |
const additions = prData.additions; | |
const deletions = prData.deletions; | |
const totalChanges = additions + deletions; | |
let label = ""; | |
if (totalChanges < 10) { | |
label = "size:XS"; | |
} else if (totalChanges < 100) { | |
label = "size:S"; | |
} else if (totalChanges < 300) { | |
label = "size:M"; | |
} else if (totalChanges < 1000) { | |
label = "size:L"; | |
} else { | |
label = "size:XL"; | |
} | |
// Apply the label | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
labels: [label], | |
}); | |
console.log(`Total lines of changes: ${totalChanges}`); | |
console.log(`Label: ${label}`); |