From 4b73eac7c32ee22eff3633516652247db5287fc7 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 13 Dec 2020 11:09:07 +0000 Subject: [PATCH 1/4] add slash command workflow --- .../autoupdate-pre-commit-config.yml | 2 +- .github/workflows/dispatched_pre-commit.yml | 33 +++++++++++++++++++ .github/workflows/slash_dispatch.yml | 15 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dispatched_pre-commit.yml create mode 100644 .github/workflows/slash_dispatch.yml diff --git a/.github/workflows/autoupdate-pre-commit-config.yml b/.github/workflows/autoupdate-pre-commit-config.yml index 42d6ae6606442..801e063f72726 100644 --- a/.github/workflows/autoupdate-pre-commit-config.yml +++ b/.github/workflows/autoupdate-pre-commit-config.yml @@ -23,7 +23,7 @@ jobs: - name: Update pre-commit config packages uses: technote-space/create-pr-action@v2 with: - GITHUB_TOKEN: ${{ secrets.ACTION_TRIGGER_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} EXECUTE_COMMANDS: | pip install pre-commit pre-commit autoupdate || (exit 0); diff --git a/.github/workflows/dispatched_pre-commit.yml b/.github/workflows/dispatched_pre-commit.yml new file mode 100644 index 0000000000000..34b29c3c00077 --- /dev/null +++ b/.github/workflows/dispatched_pre-commit.yml @@ -0,0 +1,33 @@ +name: run pre-commit + +on: + repository_dispatch: + types: [pre-commit-run-command] +jobs: + runPreCommit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + repository: ${{github.event.client_payload.pull_request.head.repo.full_name}} + ref: ${{github.event.client_payload.pull_request.head.ref}} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Cache multiple paths + uses: actions/cache@v2 + with: + path: | + ~/.cache/pre-commit + ~/.cache/pip + key: pre-commit-dispatched-${{ runner.os }}-build + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: install-pre-commit + run: python -m pip install --upgrade pre-commit + - name: Slash Command Dispatch + run: pre-commit run --all-files || (exit 0) + - run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -m "Run pre-commit" -a + git push diff --git a/.github/workflows/slash_dispatch.yml b/.github/workflows/slash_dispatch.yml new file mode 100644 index 0000000000000..c291470171c92 --- /dev/null +++ b/.github/workflows/slash_dispatch.yml @@ -0,0 +1,15 @@ +name: Slash Command Dispatch +on: + issue_comment: + types: [created] +jobs: + slashCommandDispatch: + runs-on: ubuntu-latest + steps: + - name: Slash Command Dispatch + uses: peter-evans/slash-command-dispatch@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + issue-type: pull-request + commands: | + pre-commit-run From 955a0edebdf08aa3180aaed841617e018c5c6051 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 16 Dec 2020 14:20:14 +0000 Subject: [PATCH 2/4] use arrow's action --- .github/workflows/comment_bot.yml | 57 +++++++++++++++++++++ .github/workflows/dispatched_pre-commit.yml | 33 ------------ .github/workflows/slash_dispatch.yml | 15 ------ 3 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/comment_bot.yml delete mode 100644 .github/workflows/dispatched_pre-commit.yml delete mode 100644 .github/workflows/slash_dispatch.yml diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml new file mode 100644 index 0000000000000..609767cb6b0d7 --- /dev/null +++ b/.github/workflows/comment_bot.yml @@ -0,0 +1,57 @@ +# 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: Comment-bot + +on: + issue_comment: + types: + - created + - edited + +jobs: + autotune: + name: "Fixup pre-commit formatting" + if: startsWith(github.event.comment.body, '@github-actions autotune') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/pr-fetch@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Cache multiple paths + uses: actions/cache@v2 + with: + path: | + ~/.cache/pre-commit + ~/.cache/pip + key: pre-commit-dispatched-${{ runner.os }}-build + - uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: install-pre-commit + run: python -m pip install --upgrade pre-commit + - name: Run pre-commit + run: pre-commit run --all-files || (exit 0) + - name: Commit results + run: | + git config user.name "$(git log -1 --pretty=format:%an)" + git config user.email "$(git log -1 --pretty=format:%ae)" + git commit -a -m 'Autoformat/render all the things [automated commit]' || echo "No changes to commit" + - uses: r-lib/actions/pr-push@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dispatched_pre-commit.yml b/.github/workflows/dispatched_pre-commit.yml deleted file mode 100644 index 34b29c3c00077..0000000000000 --- a/.github/workflows/dispatched_pre-commit.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: run pre-commit - -on: - repository_dispatch: - types: [pre-commit-run-command] -jobs: - runPreCommit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - repository: ${{github.event.client_payload.pull_request.head.repo.full_name}} - ref: ${{github.event.client_payload.pull_request.head.ref}} - token: ${{ secrets.GITHUB_TOKEN }} - - name: Cache multiple paths - uses: actions/cache@v2 - with: - path: | - ~/.cache/pre-commit - ~/.cache/pip - key: pre-commit-dispatched-${{ runner.os }}-build - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: install-pre-commit - run: python -m pip install --upgrade pre-commit - - name: Slash Command Dispatch - run: pre-commit run --all-files || (exit 0) - - run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -m "Run pre-commit" -a - git push diff --git a/.github/workflows/slash_dispatch.yml b/.github/workflows/slash_dispatch.yml deleted file mode 100644 index c291470171c92..0000000000000 --- a/.github/workflows/slash_dispatch.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Slash Command Dispatch -on: - issue_comment: - types: [created] -jobs: - slashCommandDispatch: - runs-on: ubuntu-latest - steps: - - name: Slash Command Dispatch - uses: peter-evans/slash-command-dispatch@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issue-type: pull-request - commands: | - pre-commit-run From 80d5c57e2a055f7d170ca4d56e163c9c8154e009 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 17 Dec 2020 07:47:20 +0000 Subject: [PATCH 3/4] update with more specific commit message --- .github/workflows/comment_bot.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml index 609767cb6b0d7..1f73c54a9fa2c 100644 --- a/.github/workflows/comment_bot.yml +++ b/.github/workflows/comment_bot.yml @@ -26,7 +26,7 @@ on: jobs: autotune: name: "Fixup pre-commit formatting" - if: startsWith(github.event.comment.body, '@github-actions autotune') + if: startsWith(github.event.comment.body, '@github-actions pre-commit') runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -43,7 +43,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.8 - - name: install-pre-commit + - name: Install-pre-commit run: python -m pip install --upgrade pre-commit - name: Run pre-commit run: pre-commit run --all-files || (exit 0) @@ -51,7 +51,7 @@ jobs: run: | git config user.name "$(git log -1 --pretty=format:%an)" git config user.email "$(git log -1 --pretty=format:%ae)" - git commit -a -m 'Autoformat/render all the things [automated commit]' || echo "No changes to commit" + git commit -a -m 'Fixes from pre-commit [automated commit]' || echo "No changes to commit" - uses: r-lib/actions/pr-push@master with: repo-token: ${{ secrets.GITHUB_TOKEN }} From 00fd05237e1b7b9056ecd002777f36a239312480 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Mon, 21 Dec 2020 15:57:23 +0000 Subject: [PATCH 4/4] remove license from file --- .github/workflows/comment_bot.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/comment_bot.yml b/.github/workflows/comment_bot.yml index 1f73c54a9fa2c..98b8e10f66f6c 100644 --- a/.github/workflows/comment_bot.yml +++ b/.github/workflows/comment_bot.yml @@ -1,20 +1,3 @@ -# 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: Comment-bot on: