Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mumrah committed Dec 16, 2024
1 parent 99cfcdd commit ca0bb39
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 70 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ Unlike trunk, the PR builds _will_ utilize the Gradle cache.
### PR Triage

In order to get the attention of committers, we have a triage workflow for Pull Requests
opened by non-committers. This workflow consists of three files:
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
* [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-trigger.yml](pr-reviewed-trigger.yml) Runs when any PR is reviewed.
Used as a trigger for the next workflow
* [pr-reviewed.yml](pr-reviewed.yml) Remove the `triage` label after a PR has been reviewed
* [pr-reviewed.yml](pr-reviewed.yml) Cron job to remove the `triage` label from PRs which have been reviewed

_The pr-update.yml workflow includes pull_request_target!_

Expand All @@ -100,7 +98,7 @@ There are two files related to this workflow:

* [pr-labeled.yml](pr-labeled.yml) approves a pending approval for PRs that have
been labeled with `ci-approved`
* [workflow-requested.yml](workflow-requested.yml) approves future workflow requests automatically
* [ci-requested.yml](ci-requested.yml) approves future workflow requests automatically
if the PR has the `ci-approved` label

_The pr-labeled.yml workflow includes pull_request_target!_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Workflow Requested
# For pull_request and pull_request_review workflows, non-committers must have an explicit
# ci-approved label on their PR before a workflow will run. This workflow is responsible for
# automatically approving pending workflow requests.
name: CI Requested

on:
workflow_run:
workflows: [CI, Pull Request Reviewed]
workflows: [CI]
types:
- requested

run-name: Workflow requested for ${{ github.event.workflow_run.display_title}}
run-name: CI Requested for ${{ github.event.workflow_run.display_title}}

jobs:
check-pr-labels:
# Even though job conditionals are difficult to debug, this will reduce the number of unnecessary runs
if: |
github.event_name == 'workflow_run' &&
(github.event.workflow_run.event == 'pull_request' || github.event.workflow_run.event == 'pull_request_review') &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.status == 'completed' &&
github.event.workflow_run.conclusion == 'action_required'
runs-on: ubuntu-latest
Expand All @@ -45,15 +42,7 @@ jobs:
with:
persist-credentials:
false
- name: Auto-approve PR Review
if: github.event.workflow_run.event == 'pull_request_review'
env:
RUN_ID: ${{ github.event.workflow_run.id }}
run: |
echo "PR_NUMBER=" >> "$GITHUB_ENV"
echo "RUN_ID=$RUN_ID" >> "$GITHUB_ENV"
- name: Check PR Labels
if: github.event.workflow_run.event == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/pr-reviewed-trigger.yml

This file was deleted.

13 changes: 6 additions & 7 deletions .github/workflows/pr-reviewed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
name: Remove Triage Label

on:
pull_request:
branches:
- trunk
workflow_dispatch: # Let us run manually

schedule:
- cron: '0 3 * * *' # Run at 3:00 UTC nightly -- just before the "stale.yml" workflow

jobs:
remove-triage:
Expand All @@ -39,7 +40,6 @@ jobs:
})
.then((pulls) => {
pulls.forEach(pull => {
console.log(pull);
github.request("GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews", {
owner: "apache",
repo: "kafka",
Expand All @@ -48,10 +48,9 @@ jobs:
"X-GitHub-Api-Version": "2022-11-28"
}
}).then((resp) => {
console.log(resp);
console.log("Found " + resp.data.length + " reviews.");
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);
console.log("Removing 'triage' label from PR " + pull.number + " : " + pull.title);
github.rest.issues.removeLabel({
owner: "apache",
repo: "kafka",
Expand Down

0 comments on commit ca0bb39

Please sign in to comment.