Skip to content

Commit 11deb62

Browse files
authored
[build][CI] Introduce automated PR governance workflows
This closes #3466
1 parent a2539f5 commit 11deb62

6 files changed

+156
-0
lines changed

.github/actions/get-workflow-origin

Submodule get-workflow-origin added at 1b5a8a6

.github/workflows/approve_label.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
name: "Label when approved workflow run"
20+
on:
21+
workflow_run:
22+
workflows: [Label-when-reviewed]
23+
types: [requested]
24+
permissions:
25+
# All other permissions are set to none
26+
checks: write
27+
contents: read
28+
pull-requests: write
29+
jobs:
30+
label-when-approved:
31+
name: "Label when approved"
32+
runs-on: ubuntu-latest
33+
outputs:
34+
isApprovedByCommiters: ${{ steps.label-when-approved-by-commiters.outputs.isApproved }}
35+
isApprovedByAnyone: ${{ steps.label-when-approved-by-anyone.outputs.isApproved }}
36+
steps:
37+
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
38+
uses: actions/checkout@v2
39+
with:
40+
persist-credentials: false
41+
submodules: recursive
42+
- name: "Get information about the original trigger of the run"
43+
uses: ./.github/actions/get-workflow-origin
44+
id: source-run-info
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
sourceRunId: ${{ github.event.workflow_run.id }}
48+
- name: Label when approved by commiters
49+
uses: ./.github/actions/label-when-approved-action
50+
id: label-when-approved-by-commiters
51+
with:
52+
token: ${{ secrets.GITHUB_TOKEN }}
53+
label: 'approved'
54+
require_committers_approval: 'true'
55+
remove_label_when_approval_missing: 'true'
56+
pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
57+
- name: Label when approved by anyone
58+
uses: ./.github/actions/label-when-approved-action
59+
id: label-when-approved-by-anyone
60+
with:
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
label: 'reviewed'
63+
pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
64+
remove_label_when_approval_missing: 'true'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
19+
name: Label-when-reviewed
20+
on: pull_request_review
21+
jobs:
22+
23+
label-when-reviewed:
24+
name: "Label PRs when reviewed"
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: "Do nothing. Only trigger corresponding workflow_run event"
28+
run: echo

.github/workflows/close_stale.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
# https://github.com/actions/stale
18+
name: 'Close stale issues and PRs'
19+
on:
20+
schedule:
21+
- cron: '0 0 * * *'
22+
permissions:
23+
# Stale recommended permissions
24+
pull-requests: write
25+
issues: write
26+
jobs:
27+
stale:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/stale@v9
31+
with:
32+
operations-per-run: 1000
33+
# Stale Issues
34+
days-before-issue-stale: 0
35+
days-before-issue-close: 0
36+
stale-issue-message: >
37+
As required by Apache Flink, please report bugs or new features on Apache Jira
38+
under the project Flink using component tag Flink CDC. You must have a JIRA account in order to log cases and issues.
39+
If you don’t have an ASF JIRA account, you can request one at the ASF Self-serve portal,
40+
account creation requires review by the PMC member of the application project, which normally takes one to two working days to be approved.
41+
close-issue-message: >
42+
This issue has been closed because Flink CDC doesn't use GitHub issue trackers.
43+
# Stale PRs
44+
days-before-pr-stale: 60
45+
days-before-pr-close: 30
46+
stale-pr-message: >
47+
This pull request has been automatically marked as stale because it has not had recent
48+
activity for 60 days. It will be closed in 30 days if no further activity occurs.
49+
close-pr-message: >
50+
This pull request has been closed because it has not had recent activity. You could reopen it
51+
if you try to continue your work, and anyone who are interested in it are encouraged to continue
52+
work on this pull request.
53+
close-pr-label: stale
54+
remove-pr-stale-when-updated: true
55+
remove-issue-stale-when-updated: true
56+
labels-to-add-when-unstale: 'waiting for review'

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[submodule "docs/themes/book"]
22
path = docs/themes/book
33
url = https://github.com/alex-shpak/hugo-book
4+
[submodule ".github/actions/get-workflow-origin"]
5+
path = .github/actions/get-workflow-origin
6+
url = https://github.com/potiuk/get-workflow-origin
7+
[submodule ".github/actions/label-when-approved-action"]
8+
path = .github/actions/label-when-approved-action
9+
url = https://github.com/TobKed/label-when-approved-action

0 commit comments

Comments
 (0)