forked from openlawteam/scalafmt-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* replace docker action with composite github action * update references * upgrade actions/checkout to v4 * switch from scalafmt:v2.3.2 * support specifying an arbitrary version of scalafmt (as long as it's available as `scalafmt-linux-glibc` in releases) * take responsibility for this action * drop GitHub Marketplace instructions (this will come back once we publish) * drop references to HCL syntax (GitHub Actions Alpha is sufficiently obsolete that no one remembers it)
- Loading branch information
Showing
14 changed files
with
91 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
act -W .github/workflows/test-regenerate-good.yml 2>/dev/null | | ||
perl -ne ' | ||
unless ($state) { | ||
$state = 1 if (/run-scalafmt\.sh/); | ||
next; | ||
} | ||
if ($state == 1) { | ||
$state = 2 if (/docker exec/); | ||
next; | ||
} | ||
last unless s/^.*\| //; | ||
print; | ||
' > .github/testdata/Good.scala |
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,3 +1,5 @@ | ||
# I dont like this formatting directive in reality, but lets | ||
# I don't like this formatting directive in reality, but it lets | ||
# us verify that this is reading a conf file easily | ||
align = most | ||
align.preset = most | ||
version = 3.7.15 | ||
runner.dialect = scala213 |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
on: [workflow_dispatch] | ||
name: Check with all testdata | ||
|
||
jobs: | ||
check-testdata: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checking testdata | ||
uses: ./ | ||
with: | ||
args: "-c .github/testdata/.scalafmt.conf --list" |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
on: [workflow_dispatch] | ||
name: Regenerate Good file (run in act) | ||
|
||
jobs: | ||
regenerate-good: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checking testdata | ||
uses: ./ | ||
with: | ||
args: "-c .github/testdata/.scalafmt.conf --stdout .github/testdata/Bad.scala" |
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,12 +1,12 @@ | ||
on: [push] | ||
name: Check with testdata | ||
name: Check with good testdata | ||
|
||
jobs: | ||
check-testdata: | ||
check-good-testdata: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Checking testdata | ||
- uses: actions/checkout@v4 | ||
- name: Checking testdata (pass) | ||
uses: ./ | ||
with: | ||
args: "-c .github/testdata/.scalafmt.conf --exclude .github/testdata/Bad.scala --list" |
This file was deleted.
Oops, something went wrong.
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,6 +1,6 @@ | ||
name: "Scalafmt Action" | ||
description: "Format Scala code using scalafmt" | ||
author: "Matthew Rothenberg <[email protected]>" | ||
author: "GarnerCorp <[email protected]>" | ||
branding: | ||
icon: "wind" | ||
color: "red" | ||
|
@@ -9,8 +9,31 @@ inputs: | |
description: "Args to pass to scalafmt" | ||
default: "--list" | ||
required: false | ||
version: | ||
description: "Version of scalafmt" | ||
default: "3.7.15" | ||
required: false | ||
|
||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
args: | ||
- ${{ inputs.args }} | ||
using: "composite" | ||
steps: | ||
- shell: bash | ||
run: | | ||
${{ github.action_path }}/set-path.sh | ||
env: | ||
scalafmt_version: ${{ inputs.version }} | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ${{ env.SCALAFMT_PATH }} | ||
key: scalafmt-${{ inputs.version }} | ||
- shell: bash | ||
if: ${{ !steps.cache.outputs.cache-hit }} | ||
run: | | ||
curl -sL https://github.com/scalameta/scalafmt/releases/download/v${scalafmt_version}/scalafmt-linux-glibc > "$SCALAFMT_PATH/scalafmt" | ||
chmod +x "$SCALAFMT_PATH/scalafmt" | ||
- shell: bash | ||
run: | | ||
${{ github.action_path }}/run-scalafmt.sh | ||
env: | ||
args: ${{ inputs.args }} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
scalafmt --non-interactive $args |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
SCALAFMT_PATH="/tmp/scalafmt/${scalafmt_version}" | ||
mkdir -p "$SCALAFMT_PATH" | ||
( | ||
echo "SCALAFMT_PATH=$SCALAFMT_PATH" | ||
echo "scalafmt_version=$scalafmt_version" | ||
) >> "$GITHUB_ENV" | ||
echo "$SCALAFMT_PATH" >> "$GITHUB_PATH" |