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 1 commit
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
43 changes: 43 additions & 0 deletions .github/actions/spotless-apply/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'spotless-apply'
description: 'Run spotlessApply and create PR'
author: 'yuhuyoyo'

inputs:
reviewers:
description: 'PR reviewers'
required: true
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 }}).*
reviewers: ${{ inputs.reviewers }}
yuhuyoyo marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 11 additions & 2 deletions .github/workflows/tests-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
workflow_dispatch: { }
schedule:
- cron: '0 5 * * *' # 5AM UTC = 12AM EST

env:
PR_REVIEWERS: "ddietterich,yuhuyoyo,zloery,mikenev,melissachang"
dexamundsen marked this conversation as resolved.
Show resolved Hide resolved
jobs:
test-source-and-install:
strategy:
Expand All @@ -23,6 +24,13 @@ jobs:
with:
java-version: 11
distribution: 'temurin'
- name: Run spotlessApply
id: spotless-apply
if: always()
uses: ./.github/actions/spotless-apply
with:
reviewers: ${{ env.PR_REVIEWERS }}
token: ${{ secrets.BROADBOT_GITHUB_TOKEN }}
- name: Cache Gradle packages
id: cache_gradle
uses: actions/cache@v2
Expand Down Expand Up @@ -118,7 +126,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