diff --git a/.github/workflows/pull-request-title-comment.md b/.github/workflows/pull-request-title-comment.md new file mode 100644 index 0000000000000..0ab3f60493b66 --- /dev/null +++ b/.github/workflows/pull-request-title-comment.md @@ -0,0 +1,13 @@ +Thanks for opening a pull request! + +Could you open an issue for this pull request on JIRA? +https://issues.apache.org/jira/browse/ARROW + +Then could you also rename pull request title in the following format? + + ARROW-\${JIRA_ID}: [${COMPONENT}] ${SUMMARY} + +See also: + + * [Other pull requests](https://github.com/apache/arrow/pulls/) + * [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches) diff --git a/.github/workflows/pull-request-title.yml b/.github/workflows/pull-request-title.yml new file mode 100644 index 0000000000000..35c8f02ddcc55 --- /dev/null +++ b/.github/workflows/pull-request-title.yml @@ -0,0 +1,80 @@ +# 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 title +on: + schedule: + # - cron: | + # */15 * * * * + - cron: | + 3 * * * * +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Check pull request title + uses: actions/github-script@0.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const {owner: owner, repo: repo} = context.repo; + + function haveJIRAID(title) { + if (!title) { + return false; + } + return /^ARROW-\d+/.test(title); + } + + async function commentOpenJIRAIssue(pullRequestNumber) { + const {data: comments} = await github.issues.listComments({ + owner: owner, + repo: repo, + issue_number: pullRequestNumber, + per_page: 1 + }); + if (comments.length > 0) { + return; + } + const response = await github.repos.getContents({ + owner: owner, + repo: repo, + path: ".github/workflows/pull-request-title-comment.md", + ref: context.sha + }); + await github.issues.createComment({ + owner: owner, + repo: repo, + issue_number: pullRequestNumber, + body: response.data.content + }); + } + + (async () => { + const {data: pulls} = await github.pulls.list({ + owner: owner, + repo: repo, + }); + pulls.forEach(async (pull) => { + const pullRequestNumber = pull.number; + const title = pull.title; + if (!haveJIRAID(title)) { + await commentOpenJIRAIssue(pullRequestNumber); + } + }); + })(); diff --git a/README.md b/README.md index ef498df1df48d..e41046284446b 100644 --- a/README.md +++ b/README.md @@ -90,3 +90,4 @@ integrations in other projects, we'd be happy to have you involved: [3]: https://issues.apache.org/jira/browse/ARROW [4]: https://github.com/apache/arrow [5]: https://github.com/apache/arrow/blob/master/docs/source/developers/contributing.rst +