Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PF-1924: Add an action to run spotlessApply #310

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/actions/spotless-apply/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'spotless-apply'
description: 'Run spotlessApply and create PR'
author: 'yuhuyoyo'

inputs:
token:
description: 'broadbot token for creating PR'
required: true
outputs:
spotlesscheck:
description: 'success if the code base is spotless and no further action needed'
value: ${{ steps.spotless-check.outcome }}
runs:
using: "composite"
steps:
- name: spotless check
id: spotless-check
run: ./gradlew spotlessCheck
shell: bash
- name: spotless apply
id: spotless-apply
if: failure() && steps.spotless-check.outcome == 'failure'
run: ./gradlew spotlessApply
shell: bash
- name: create PR
id: create-pr
uses: peter-evans/create-pull-request@v4
if: failure() && steps.spotless-apply.outcome == 'success'
with:
token: ${{ inputs.token }}
commit-message: "Terra CLI spotless apply"
committer: terracli-bot <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Terra CLI spotless apply"
branch: "actions/spotlessApply"
delete-branch: true
body: |
Run spotlessApply.
*Note: This PR was opened by the [nightly-test GitHub Actions workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).*
9 changes: 8 additions & 1 deletion .github/workflows/tests-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
with:
java-version: 11
distribution: 'temurin'
- name: Run spotlessApply
id: spotless-apply
if: always()
uses: ./.github/actions/spotless-apply
with:
token: ${{ secrets.BROADBOT_GITHUB_TOKEN }}
- name: Cache Gradle packages
id: cache_gradle
uses: actions/cache@v2
Expand Down Expand Up @@ -118,7 +124,8 @@ jobs:
L2="Unit: ${{ steps.run_unit_tests.outcome }} "
L3="Integ (Source): ${{ steps.run_integration_tests_against_source_code.outcome }} "
L4="Integ (Release): ${{ steps.run_integration_tests_against_release.outcome }}"
bold="$L2 | $L3 | $L4"
L5="Lint: ${{ steps.spotless-apply.outputs.spotlesscheck }}"
bold="$L2 | $L3 | $L4 | $L5"
text="Link to <https://github.com/DataBiosphere/terra-cli/actions/runs/$GITHUB_RUN_ID|test run>"
if [ "${{ job.status }}" == "success" ]; then
text=":white_check_mark: $text"
Expand Down