kou commented on code in PR #55885: URL: https://github.com/apache/arrow/pull/55885#discussion_r4782173376
########## .github/workflows/triage.yml: ########## @@ -0,0 +1,125 @@ +# 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: PR Triage + +on: + schedule: + - cron: "15 * * * *" + workflow_dispatch: + +permissions: + contents: read + +jobs: + triage: + name: Label and Close Untriaged PRs + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/github-script@v9 + with: + script: | + const LABEL = 'Status: Needs triage'; + const TRUSTED = new Set(['OWNER', 'MEMBER', 'COLLABORATOR', 'CONTRIBUTOR']); + const EXEMPT_USERS = new Set(['dependabot[bot]', 'github-actions[bot]']); + const DAY_MS = 24 * 60 * 60 * 1000; + const CLOSE_AFTER_DAYS = 5; + const now = Date.now(); + const repo = context.repo; + + const lastLabeledAt = async (issue_number) => { + const events = await github.paginate(github.rest.issues.listEvents, { + ...repo, + issue_number, + per_page: 100, + }); + let ts = null; + for (const e of events) { + if (e.event === 'labeled' && e.label?.name === LABEL) { + const t = Date.parse(e.created_at); + if (ts === null || t > ts) ts = t; + } + } + return ts; + }; + + // 1. Close PRs still in 'Status: Needs triage' after CLOSE_AFTER_DAYS days Review Comment: Can we reuse `actions/stale` instead of implementing this by ourselves? ########## .github/workflows/triage.yml: ########## @@ -0,0 +1,125 @@ +# 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: PR Triage + +on: + schedule: + - cron: "15 * * * *" + workflow_dispatch: + +permissions: + contents: read + +jobs: + triage: Review Comment: Could you add `if: github.repository == 'apache/arrow` to avoid running this on fork repositories? -- 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]
