Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra] Enforce type labels on PRs #275

Merged

Conversation

michelengelen
Copy link
Member

This pull request introduces a new GitHub Actions workflow and a supporting script to ensure that pull requests have appropriate type labels. The most important changes include the creation of the workflow file and the implementation of the script to check for type labels.

New workflow for checking PR type labels:

  • .github/workflows/prs_check-if-pr-has-type-label.yml: Added a new workflow to check if pull requests have appropriate type labels. This workflow runs on a PR event and uses the actions/checkout and actions/github-script actions to execute the label checking script.

Implementation of the label checking script:

  • .github/workflows/scripts/prs/checkTypeLabel.js: Added a script that verifies the presence of type labels on pull requests. The script checks for specific labels, creates comments on the PR if the labels are missing or incorrect, and fails the workflow to prevent merging without proper labels.

PRs should be labeled according to their purpose. release, bug/regression and enhancement/new feature should be self explanatory. maintenance is meant to categorize refactors, cleanups and structural changes. dependencies is similar, but not quite the same. We could potentially combine the two into one.

This commit introduces a GitHub Action to ensure pull requests have exactly one type label. If no label or multiple labels are found, an explanatory comment is left on the PR. This helps standardize PR categorization and improve workflow consistency.

This may as well make the "Check if PR has label" workflow obsolete
Add a `core.setFailed` call to ensure the workflow fails if a PR is merged without valid type labels. This prevents incomplete label verification from being bypassed, ensuring stricter adherence to standards.
This update includes 'dependencies' as an allowed label for PRs. It ensures better categorization and aligns with the labeling standards for managing dependency-related changes.
@michelengelen michelengelen added the scope: infra Org infrastructure work going on behind the scenes label Feb 27, 2025
@michelengelen michelengelen self-assigned this Feb 27, 2025
@michelengelen michelengelen merged commit 5ae0875 into mui:master Feb 28, 2025
7 checks passed
@michelengelen michelengelen deleted the automation/enforce-type-labels-on-prs branch February 28, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: infra Org infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants