diff --git a/.github/close-pending.sh b/.github/close-pending.sh deleted file mode 100755 index 5ed27d31a10c..000000000000 --- a/.github/close-pending.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -MESSAGE=$(cat $SCRIPT_DIR/closing-message.txt) - -while IFS= read -r number && - IFS= read -r title; do - echo "Closing PR ($number): $title" - curl -s -o /dev/null \ - -X POST \ - --data "$(jq --arg body "$MESSAGE" -n '{body: $body}')" \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - --header 'content-type: application/json' \ - "https://api.github.com/repos/apache/ozone/issues/$number/comments" - - curl -s -o /dev/null \ - -X PATCH \ - --data '{"state": "close"}' \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - --header 'content-type: application/json' \ - "https://api.github.com/repos/apache/ozone/pulls/$number" -done < <(curl -H "Content-Type: application/json" \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - "https://api.github.com/search/issues?q=repo:apache/ozone+type:pr+updated:<$(date -d "-21 days" +%Y-%m-%d)+label:pending+is:open" \ - | jq -r '.items[] | (.number,.title)') diff --git a/.github/closing-message.txt b/.github/closing-message.txt deleted file mode 100644 index 261eac275e0e..000000000000 --- a/.github/closing-message.txt +++ /dev/null @@ -1,7 +0,0 @@ -Thank you very much for the patch. I am closing this PR __temporarily__ as there was no activity recently and it is waiting for response from its author. - -It doesn't mean that this PR is not important or ignored: feel free to reopen the PR at any time. - -It only means that attention of committers is not required. We prefer to keep the review queue clean. This ensures PRs in need of review are more visible, which results in faster feedback for all PRs. - -If you need ANY help to finish this PR, please [contact the community](https://github.com/apache/hadoop-ozone#contact) on the mailing list or the slack channel." diff --git a/.github/workflows/close-pending.yaml b/.github/workflows/close-pending.yaml deleted file mode 100644 index 3dfe736cd39d..000000000000 --- a/.github/workflows/close-pending.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -name: close-prs - -on: - schedule: - - cron: '0 0 * * *' - -jobs: - close-pending: - name: close-pending - runs-on: ubuntu-24.04 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Execute close-pending script - if: github.repository == 'apache/ozone' - run: ./.github/close-pending.sh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/close-stale-prs.yml b/.github/workflows/close-stale-prs.yml new file mode 100644 index 000000000000..1ac206b420c4 --- /dev/null +++ b/.github/workflows/close-stale-prs.yml @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +name: close-stale-prs + +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + inputs: + days-before-stale: + description: 'Days before marking PR as stale (default: 21)' + required: false + default: '21' + days-before-close: + description: 'Days before closing stale PR (default: 7)' + required: false + default: '7' + debug-only: + description: 'Debug mode - only log, do not make changes' + required: false + type: boolean + default: false + +jobs: + stale: + permissions: + actions: write + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Close Stale PRs + uses: actions/stale@v10 + with: + stale-pr-message: 'This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.' + close-pr-message: 'Thank you for your contribution. This PR is being closed because it has been inactive for 28 days. If you wish to continue working on it, feel free to reopen the PR at any time.' + days-before-pr-stale: ${{ github.event.inputs.days-before-stale || 21 }} + days-before-pr-close: ${{ github.event.inputs.days-before-close || 7 }} + stale-pr-label: 'stale' + remove-pr-stale-when-updated: true + only-pr-labels: '' + debug-only: ${{ github.event.inputs.debug-only == 'true' }}