diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 29a72b188c05b..1087a3c1d6042 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -69,9 +69,11 @@ Unlike trunk, the PR builds _will_ utilize the Gradle cache. In order to get the attention of committers, we have a triage workflow for Pull Requests opened by non-committers. This workflow consists of two files: -* [pr-update.yml](pr-update.yml) When a PR is created, add the `triage` label if the PR - was opened by a non-committer. -* [pr-reviewed.yml](pr-reviewed.yml) Cron job to remove the `triage` label from PRs which have been reviewed +* [pr-update.yml](pr-update.yml) When a PR is created, add the `triage` label if + the PR was opened by a non-committer. +* [pr-labels-cron.yml](pr-labels-cron.yml) Cron job to add `needs-attention` label to community + PRs that have not been reviewed after 7 days. Also includes a cron job to + remove the `triage` and `needs-attention` labels from PRs which have been reviewed. _The pr-update.yml workflow includes pull_request_target!_ @@ -82,7 +84,8 @@ organization must be public. Here are the steps to take: * Find yourself * Change "Organization Visibility" to Public -Full documentation for this process can be found in GitHub's docs: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership +Full documentation for this process can be found in GitHub's docs: +https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership If you are a committer and do not want your membership in the ASF org listed as public, you will need to remove the `triage` label manually. diff --git a/.github/workflows/pr-reviewed.yml b/.github/workflows/pr-labels-cron.yml similarity index 54% rename from .github/workflows/pr-reviewed.yml rename to .github/workflows/pr-labels-cron.yml index d39a7abf0a0c5..5faaca72ed36b 100644 --- a/.github/workflows/pr-reviewed.yml +++ b/.github/workflows/pr-labels-cron.yml @@ -13,17 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Remove Triage Label +name: Fixup PR Labels on: workflow_dispatch: # Let us run manually schedule: - - cron: '0 3 * * *' # Run at 3:00 UTC nightly -- just before the "stale.yml" workflow + - cron: '0 3 * * *' # Run at 3:00 UTC nightly jobs: - remove-triage: + # This job removes the triage and needs-attention labels from any PRs that have been reviewed. Once reviewed, it is + # assumed that a PR does _not_ need extra attention from the committers, so these labels can be removed. + fixup-pr-labels: runs-on: ubuntu-latest + strategy: + matrix: + label: [triage, needs-attention] steps: - name: Env run: printenv @@ -35,8 +40,9 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | + console.log("Finding PRs with label '${{ matrix.label }}'"); github.paginate("GET /search/issues{?q}", { - q: "repo:apache/kafka label:triage is:pull-request" + q: "repo:apache/kafka label:${{ matrix.label }} is:pull-request" }) .then((pulls) => { pulls.forEach(pull => { @@ -50,14 +56,37 @@ jobs: }).then((resp) => { console.log("Found " + resp.data.length + " reviews for PR " + pull.number); if (resp.data.length > 0) { - console.log("Removing 'triage' label from PR " + pull.number + " : " + pull.title); + console.log("Removing '${{ matrix.label }}' label from PR " + pull.number + " : " + pull.title); github.rest.issues.removeLabel({ owner: "apache", repo: "kafka", issue_number: pull.number, - name: "triage" + name: "${{ matrix.label }}" }); } }); }); }); + + # This job adds a 'needs-attention' label to any PR that has not been updated in 7 days and has been labeled with 'triage'. + # The idea here is to give committers a quick way to see which PRs have languished and need attention. + needs-attention: + runs-on: ubuntu-latest + needs: [fixup-pr-labels] + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v9 + with: + debug-only: ${{ inputs.dryRun || false }} + operations-per-run: ${{ inputs.operationsPerRun || 500 }} + days-before-stale: 7 + days-before-close: -1 + ignore-pr-updates: true + only-pr-labels: 'triage' + stale-pr-label: 'needs-attention' + stale-pr-message: | + A label of 'needs-attention' was automatically added to this PR in order to raise the + attention of the committers. Once this issue has been triaged, the `triage` label + should be removed to prevent this automation from happening again. diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 6ceb074f62c10..9382d4173e94c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -35,22 +35,6 @@ permissions: pull-requests: write jobs: - needs-attention: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v9 - with: - debug-only: ${{ inputs.dryRun || false }} - operations-per-run: ${{ inputs.operationsPerRun || 500 }} - days-before-stale: 7 - days-before-close: -1 - ignore-pr-updates: true - only-pr-labels: 'triage' - stale-pr-label: 'needs-attention' - stale-pr-message: | - A label of 'needs-attention' was automatically added to this PR in order to raise the - attention of the committers. Once this issue has been triaged, the `triage` label - should be removed to prevent this automation from happening again. stale: runs-on: ubuntu-latest steps: