lupyuen commented on issue #18359: URL: https://github.com/apache/nuttx/issues/18359#issuecomment-3888292281
_After switching to the Two-Step Trigger (pull_request + workflow_run), Arch Labeling works OK. What about Size Labeling?_ Yep Size Labeling works OK too! Here's a PR with the correct Size Label applied: https://github.com/lupyuen6/nuttx/pull/24 > <img width="907" height="857" alt="Image" src="https://github.com/user-attachments/assets/d6444c0b-18da-4adc-9554-54fbda7334d0" /> _How does it work?_ Our pull_request trigger calls GitHub API to fetch the names of updated PR files, and the number of lines changed... ```text { status: 'added', filename: 'arch/arm/test.txt', additions: 3, deletions: 0, changes: 3 } { status: 'removed', filename: 'Documentation/legacy_README.md', additions: 0, deletions: 2531, changes: 2531 } { status: 'modified', filename: 'Documentation/security.rst', additions: 1, deletions: 0, changes: 1 } ``` https://github.com/lupyuen6/nuttx/blob/master/.github/workflows/labeler.yml <img width="1720" height="771" alt="Image" src="https://github.com/user-attachments/assets/5276b846-bf71-4251-86db-6836a0a1b2aa" /> Across All Files: We sum up the number of lines changed (ignoring the deleted files)... https://github.com/lupyuen6/nuttx/blob/master/.github/workflows/labeler.yml <img width="1098" height="504" alt="Image" src="https://github.com/user-attachments/assets/b1b044c6-be24-4634-842f-e5b94d477dd3" /> We select the Size Label for the PR... https://github.com/lupyuen6/nuttx/blob/master/.github/workflows/labeler.yml <img width="1184" height="498" alt="Image" src="https://github.com/user-attachments/assets/9ba2a3ab-cfaa-47e2-a22d-375e441188bf" /> And we save the Size Label into a PR Artifact... https://github.com/lupyuen6/nuttx/blob/master/.github/workflows/labeler.yml <img width="1233" height="672" alt="Image" src="https://github.com/user-attachments/assets/211530af-9a72-4cd4-ab9b-860a56eeee6f" /> When the pull_request workflow ends: It triggers workflow_run. Which will read the Size Label from the PR Artifact, and save it into the PR... https://github.com/lupyuen6/nuttx/blob/master/.github/workflows/pr_labeler.yml <img width="2409" height="1509" alt="Image" src="https://github.com/user-attachments/assets/89d3901b-4d5c-4ee9-a006-6de523fb49f0" /> Up Next: I'll work out all the Test Cases for our new implementation of PR Labeling: - Simple PR: Arm32-only, Arm64-only, RISC-V-only, ... - Complex PR: Drivers, Arm32 + Arm64, Arm32 + RISC-V, ... - Doc PR, ... Also: I'll hang out on Slack and find out how other Apache Projects are handling pull_request_target. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
