Skip to content

Commit

Permalink
Update entrypoint.sh (#2)
Browse files Browse the repository at this point in the history
* Update entrypoint.sh

* Add JuliaFormatter at top of format.jl

* Try different way of adding JuliaFormatter
  • Loading branch information
odow authored and domluna committed Sep 19, 2019
1 parent 3211321 commit 41501b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ LABEL "repository"="https://github.com/domluna/JuliaFormatter-action"
LABEL "homepage"="https://github.com/domluna/JuliaFormatter-action"
LABEL "maintainer"="Dominique Luna <[email protected]>"

RUN julia -e 'using Pkg; Pkg.add("JuliaFormatter"); using JuliaFormatter'

COPY format.jl /format.jl
COPY entrypoint.sh /entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e
set -o pipefail

/format.jl "$@"
julia format.jl "$@"
21 changes: 19 additions & 2 deletions format.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
#!/usr/bin/env julia

println(pwd())
println(readdir())
import Pkg

if isfile("Project.toml")
# Okay, we're in $GITHUB_WORKSPACE, and we have a Julia package.
project = read("Project.toml", String)
if occursin("uuid = \"98e50ef6-434e-11e9-1051-2b60c6c9e899\"", project)
# This package is JuliaFormatter itself. Let's use the copy stored here
# instead of the last taged version
Pkg.add(Pkg.PackageSpec(path = pwd()))
else
# This is a package that's not JuliaFormatter. Just use the last tagged
# version of JuliaFormatter.jl.
Pkg.add("JuliaFormatter")
end
else
# This doesn't look like a standard Julia package, but it might be a script.
# In any case, it isn't JuliaFormatter.jl.
Pkg.add("JuliaFormatter")
end

using JuliaFormatter

Expand Down

0 comments on commit 41501b7

Please sign in to comment.