From cdafa6b08d22f3e104d07cebaf2c7624fa4a3a76 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 13 Oct 2020 14:48:36 -0700 Subject: [PATCH] ci(java): suggest formatting fixes GitHub action config to run the java formatter and suggest inline fixes on the pull request. This was tested in java-asset: [example PR](https://github.com/googleapis/java-asset/pull/392). Source-Author: Jeff Ching Source-Date: Tue Oct 13 09:04:08 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: b65ef07d99946d23e900ef2cc490274a16edd336 Source-Link: https://github.com/googleapis/synthtool/commit/b65ef07d99946d23e900ef2cc490274a16edd336 --- .github/workflows/formatting.yaml | 25 +++++++++++++++++++++++++ synth.metadata | 5 +++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/formatting.yaml diff --git a/.github/workflows/formatting.yaml b/.github/workflows/formatting.yaml new file mode 100644 index 000000000..d4d367cfc --- /dev/null +++ b/.github/workflows/formatting.yaml @@ -0,0 +1,25 @@ +on: + pull_request_target: + types: [opened, synchronize] + branches: + - master +name: format +jobs: + format-code: + runs-on: ubuntu-latest + env: + ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: actions/setup-java@v1 + with: + java-version: 11 + - run: "mvn com.coveo:fmt-maven-plugin:format" + - uses: googleapis/code-suggester@v1.8.0 + with: + command: review + pull_number: ${{ github.event.pull_request.number }} + git_dir: '.' diff --git a/synth.metadata b/synth.metadata index a84971382..7318209ed 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigquery.git", - "sha": "afadff94bc9a769a2fb3b44ce423cec7c6b029fb" + "sha": "4ea34b55d43d3e58215bc7019ff86d56864feacd" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "0762e8ee2ec21cdfc4d82020b985a104feb0453b" + "sha": "b65ef07d99946d23e900ef2cc490274a16edd336" } } ], @@ -26,6 +26,7 @@ ".github/trusted-contribution.yml", ".github/workflows/auto-release.yaml", ".github/workflows/ci.yaml", + ".github/workflows/formatting.yaml", ".github/workflows/samples.yaml", ".kokoro/build.bat", ".kokoro/build.sh",