-
Notifications
You must be signed in to change notification settings - Fork 14k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MINOR Add PR triage workflow (#17881)
Automatically adds a "triage" label to PRs from the community. After 7 days, if no review has been made and the "triage" label is still present, a "needs-attention" label is added. Reviewers: Chia-Ping Tsai <[email protected]>, Mickael Maison <[email protected]>
- Loading branch information
Showing
5 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 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: Pull Request Reviewed | ||
|
||
on: | ||
pull_request_review: | ||
types: | ||
- submitted | ||
|
||
jobs: | ||
# This job is a workaround for the fact that pull_request_review lacks necessary permissions to modify PRs. | ||
# Also, there is no pull_request_target analog to pull_request_review. The approach taken here is taken from | ||
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/. | ||
pr-review-trigger: | ||
name: Reviewed | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Env | ||
run: printenv | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
- name: Capture PR Number | ||
run: | ||
echo ${{ github.event.pull_request.number }} >> pr-number.txt | ||
- name: Archive Event | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pr-number.txt | ||
path: pr-number.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# 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: Remove Triage Label | ||
|
||
on: | ||
workflow_run: | ||
workflows: [Pull Request Reviewed] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
# This job runs with elevated permissions and the ability to modify pull requests. The steps taken here | ||
# should be limited to updating labels and adding comments to PRs. This approach is taken from | ||
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/. | ||
remove-triage: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Env | ||
run: printenv | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
github-token: ${{ github.token }} | ||
run-id: ${{ github.event.workflow_run.id }} | ||
name: pr-number.txt | ||
- name: Remove label | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
var fs = require('fs'); | ||
var pr_number = Number(fs.readFileSync('./pr-number.txt')); | ||
await github.rest.issues.removeLabel({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pr_number, | ||
name: 'triage' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters