# Tip: use Julia as custom shell in GitHub Actions

**URL:** https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377
**Category:** Tooling
**Created:** [January 15, 2021, 10:22am UTC](https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377 "2021-01-15T10:22:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [January 15, 2021, 10:22am UTC](https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377/1 "2021-01-15T10:22:10Z")

</div>

This isn’t maybe very well-known, but in GitHub Actions you can run commands using [custom shells](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#custom-shell), including `julia`.

For example, in a package I always want to test on CI a package using the latest development revision of a dependency. You can achieve this with a step like:

```yaml
      - name: Install extra dependency on main branch
        shell: julia --color=yes --project=. {0}
        run: |
          using Pkg
          Pkg.add(PackageSpec(; name="AnExtraPackage", rev="main"))

```

This isn’t much different from the standard

```yaml
      - name: Install extra dependency on main branch
        run: |
          julia --project=. -e 'using Pkg; Pkg.add(PackageSpec(; name="AnExtraPackage", rev="main"))'

```

but using the custom shell makes it nicer to write a multiline Julia script.

---

<div class="post-metadata">

### Author: ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)
#### Post date: [January 20, 2021, 1:59pm UTC](https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377/2 "2021-01-20T13:59:25Z")

</div>

Does it work with `]add APackage@1.2.3`?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [January 20, 2021, 2:17pm UTC](https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377/3 "2021-01-20T14:17:33Z")

</div>

No because `]add...` isn’t valid Julia syntax (`ERROR: syntax: unexpected "]"`). You _could_ use the `pkg"..."` string literal, but its usage is frowned upon in scripts, because the syntax may break.

---

<div class="post-metadata">

### Author: ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)
#### Post date: [March 6, 2023, 2:33pm UTC](https://discourse.julialang.org/t/tip-use-julia-as-custom-shell-in-github-actions/53377/4 "2023-03-06T14:33:04Z")

</div>

A quick comment about where this can be important: if you want to `develop` a dependency that lives in a subdir package, you might use `'using Pkg; Pkg.develop(path=joinpath(pwd(), "SubdirPackage"))'` in your `CI.yml` file. But Windows seems to choke on some aspect of escaping. Using a Julia shell to run that command fixes the problem. (Thanks to @fredrikekre for pointing this out.)
