From 0cdd34821f11d208b4294a97d61ff0877211a3c3 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 7 Jan 2021 10:56:27 +0900 Subject: [PATCH] ARROW-11159: [Developer] Consolidate pull request related jobs --- .github/workflows/dev_jira.yml | 52 ------------ .github/workflows/dev_labeler.yml | 33 -------- .github/workflows/dev_labeler_pr_rebase.yml | 33 -------- .github/workflows/dev_pr.yml | 83 +++++++++++++++++++ .../{dev_labeler => dev_pr}/labeler.yml | 0 .../workflows/{dev_jira => dev_pr}/link.js | 0 .../{dev_jira => dev_pr}/title_check.js | 2 +- .../{dev_jira => dev_pr}/title_check.md | 0 8 files changed, 84 insertions(+), 119 deletions(-) delete mode 100644 .github/workflows/dev_jira.yml delete mode 100644 .github/workflows/dev_labeler.yml delete mode 100644 .github/workflows/dev_labeler_pr_rebase.yml create mode 100644 .github/workflows/dev_pr.yml rename .github/workflows/{dev_labeler => dev_pr}/labeler.yml (100%) rename .github/workflows/{dev_jira => dev_pr}/link.js (100%) rename .github/workflows/{dev_jira => dev_pr}/title_check.js (96%) rename .github/workflows/{dev_jira => dev_pr}/title_check.md (100%) diff --git a/.github/workflows/dev_jira.yml b/.github/workflows/dev_jira.yml deleted file mode 100644 index 6c301a0ce07..00000000000 --- a/.github/workflows/dev_jira.yml +++ /dev/null @@ -1,52 +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: PR JIRA integration - -on: - pull_request_target: - types: - - opened - - edited - -jobs: - - link: - name: Link - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Comment - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const script = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_jira/link.js`); - script({github, context}); - - title-check: - name: Title check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Check - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const script = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_jira/title_check.js`); - script({github, context}); diff --git a/.github/workflows/dev_labeler.yml b/.github/workflows/dev_labeler.yml deleted file mode 100644 index bb4a8dbe2d3..00000000000 --- a/.github/workflows/dev_labeler.yml +++ /dev/null @@ -1,33 +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: PR labeler -on: - pull_request_target: - types: [opened, reopened] - -jobs: - label: - name: Label - runs-on: ubuntu-latest - steps: - - name: Assign Github labels - uses: actions/labeler@2.2.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/workflows/dev_labeler/labeler.yml - sync-labels: true diff --git a/.github/workflows/dev_labeler_pr_rebase.yml b/.github/workflows/dev_labeler_pr_rebase.yml deleted file mode 100644 index a94603386c5..00000000000 --- a/.github/workflows/dev_labeler_pr_rebase.yml +++ /dev/null @@ -1,33 +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: PR rebase needed labeler -on: - push: - pull_request_target: - types: [synchronize] - -jobs: - label: - name: Label - runs-on: ubuntu-latest - steps: - - name: Checks if PR needs rebase - uses: eps1lon/actions-label-merge-conflict@releases/2.x - with: - dirtyLabel: "needs-rebase" - repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml new file mode 100644 index 00000000000..7b92b897051 --- /dev/null +++ b/.github/workflows/dev_pr.yml @@ -0,0 +1,83 @@ +# 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: Dev PR + +on: + # TODO: Enable this when eps1lon/actions-label-merge-conflict is available. + # push: + # branches: + # - master + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + process: + name: Process + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Comment JIRA link + if: | + github.event_name == 'pull_request_target' && + (github.event.action == 'opened' || + github.event.action == 'edited') + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const script = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr/link.js`); + script({github, context}); + + - name: Check title + if: | + github.event_name == 'pull_request_target' && + (github.event.action == 'opened' || + github.event.action == 'edited') + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const script = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr/title_check.js`); + script({github, context}); + + - name: Assign GitHub labels + if: | + github.event_name == 'pull_request_target' && + (github.event.action == 'opened' || + github.event.action == 'synchronize') + uses: actions/labeler@2.2.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: .github/workflows/dev_pr/labeler.yml + sync-labels: true + + # TODO: Enable this when eps1lon/actions-label-merge-conflict is available. + # - name: Checks if PR needs rebase + # if: | + # github.event_name == 'push' || + # (github.event_name == 'pull_request_target' && + # (github.event.action == 'opened' || + # github.event.action == 'synchronize')) + # uses: eps1lon/actions-label-merge-conflict@releases/2.x + # with: + # dirtyLabel: "needs-rebase" + # repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/dev_labeler/labeler.yml b/.github/workflows/dev_pr/labeler.yml similarity index 100% rename from .github/workflows/dev_labeler/labeler.yml rename to .github/workflows/dev_pr/labeler.yml diff --git a/.github/workflows/dev_jira/link.js b/.github/workflows/dev_pr/link.js similarity index 100% rename from .github/workflows/dev_jira/link.js rename to .github/workflows/dev_pr/link.js diff --git a/.github/workflows/dev_jira/title_check.js b/.github/workflows/dev_pr/title_check.js similarity index 96% rename from .github/workflows/dev_jira/title_check.js rename to .github/workflows/dev_pr/title_check.js index a6ce92cc756..2a8d654567e 100644 --- a/.github/workflows/dev_jira/title_check.js +++ b/.github/workflows/dev_pr/title_check.js @@ -34,7 +34,7 @@ async function commentOpenJIRAIssue(github, context, pullRequestNumber) { if (comments.length > 0) { return; } - const commentPath = ".github/workflows/dev_jira/title_check.md"; + const commentPath = ".github/workflows/dev_pr/title_check.md"; const comment = fs.readFileSync(commentPath).toString(); await github.issues.createComment({ owner: context.repo.owner, diff --git a/.github/workflows/dev_jira/title_check.md b/.github/workflows/dev_pr/title_check.md similarity index 100% rename from .github/workflows/dev_jira/title_check.md rename to .github/workflows/dev_pr/title_check.md