-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into aen_require_curl_jq
- Loading branch information
Showing
7 changed files
with
95 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,64 @@ | ||
name: 'Scalafmt' | ||
name: 'ScalaFmt Fix' | ||
|
||
# This GitHub Action runs the ScalaFmt linting tool on the entire codebase. | ||
# It will fix, commit, and push linted code. | ||
# It will only run when someone comments "scalafmt" on a PR. | ||
|
||
run-name: ${{ format('ScalaFmt Fix on {0}', github.ref_name) }} | ||
run-name: ScalaFmt Fix | ||
|
||
on: | ||
workflow_dispatch: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
branch_name: | ||
description: 'Branch to run ScalaFmt against' | ||
required: true | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
|
||
jobs: | ||
run-scalafmt-fix: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.target-branch }} | ||
- uses: ./.github/set_up_cromwell_action | ||
with: | ||
cromwell_repo_token: ${{ secrets.BROADBOT_GITHUB_TOKEN }} | ||
- name: Determine Target Branch | ||
id: determine-branch | ||
run: | | ||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | ||
echo "::set-output name=target_branch::${{ inputs.branch_name }}" | ||
else | ||
echo "::set-output name=target_branch::${{ github.event.pull_request.head.ref }}" | ||
fi | ||
shell: bash | ||
env: | ||
inputs.branch_name: ${{ inputs.branch_name }} | ||
- name: Check for ScalaFmt Comment | ||
id: check-comment | ||
run: | | ||
if [[ "${{ github.event_name }}" == "issue_comment" && "${{ github.event.comment.body }}" == *"scalafmt"* ]]; then | ||
echo "::set-output name=comment-triggered::true" | ||
echo "::set-output name=comment-author-email::${{ github.event.comment.user.login }}@users.noreply.github.com" | ||
echo "::set-output name=comment-author-name::${{ github.event.comment.user.login }}" | ||
else | ||
echo "::set-output name=comment-triggered::false" | ||
fi | ||
shell: bash | ||
- name: Run ScalaFmt | ||
- uses: actions/checkout@v3 # checkout the cromwell repo | ||
with: | ||
ref: ${{ inputs.target-branch }} | ||
- uses: ./.github/set_up_cromwell_action | ||
with: | ||
cromwell_repo_token: ${{ secrets.BROADBOT_GITHUB_TOKEN }} | ||
- name: Run ScalaFmt Fixup | ||
if: steps.check-comment.outputs.comment-triggered == 'true' || github.event_name == 'workflow_dispatch' | ||
env: | ||
BROADBOT_GITHUB_TOKEN: ${{ secrets.BROADBOT_GITHUB_TOKEN }} | ||
run: | | ||
if [[ ${{ steps.check-comment.outputs.comment-triggered }} == true ]]; then | ||
echo "PR Comment Detected. Formatting, committing, and pushing formatted scala code." | ||
sbt scalaFmtAll | ||
git config --global user.email "${{ steps.check-comment.outputs.comment-author-email }}" | ||
git config --global user.name "${{ steps.check-comment.outputs.comment-author-name }}" | ||
git add . | ||
git commit -m "Auto-format code with ScalaFmt" | ||
git push origin ${{ github.ref }} | ||
fi | ||
sbt scalafmtAll | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Broad Bot" | ||
git add . | ||
git commit -m "ScalaFmt fixup via Broad Bot" | ||
git push origin ${{ steps.determine-branch.outputs.target_branch }} | ||
working-directory: ${{ github.workspace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters