Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/** -diff linguist-generated=true
* text=auto eol=lf
dist/** -diff linguist-generated=true
48 changes: 48 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Check Transpiled JavaScript

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
run: npm ci

- name: Build dist/ Directory
run: npm run package

- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi

- if: ${{ failure() && steps.diff.conclusion == 'failure' }}
name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read

jobs:
typescript:
name: TypeScript Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
run: npm ci

- name: Check Format
run: npm run format:check

- name: Lint
run: npm run lint

- name: Test
run: npm run ci-test
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: 'nix-shell-action-test'
name: "nix-shell-action-test"
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- support-devshell
- 'releases/*'
- "releases/*"

jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: 20
node-version-file: .node-version
- run: |
npm install
- run: |
npm run all
test-latest-nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
test-legacy-nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
test-flakes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand All @@ -112,7 +112,7 @@ jobs:
test-local-flake-in-working-directory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand All @@ -131,7 +131,7 @@ jobs:
test-flakes-from-devshell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand All @@ -148,7 +148,7 @@ jobs:
test-flakes-from-devshell-with-custom-shell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand All @@ -166,7 +166,7 @@ jobs:
test-flakes-from-devshell-in-working-directory:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21.7.2
24.4.0
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist/
node_modules/
coverage/
.DS_Store
.licenses/
16 changes: 0 additions & 16 deletions .prettierrc.json

This file was deleted.

27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ on Linux and macOS.
Create `.github/workflows/test.yml` in your repo with the following contents:

```yaml
name: 'Test'
name: "Test"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: workflow/nix-shell-action@v3
Expand Down Expand Up @@ -57,17 +57,17 @@ flakes to be available in your script. This can be used for both local flakes in
a `flake.nix` in your repo, as well as external flakes.

```yaml
name: 'Test'
name: "Test"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand All @@ -88,17 +88,17 @@ Instead of specifying `flakes`, you can also tell this action to re-use the
make these available to the script:

```yaml
name: 'Test with Flakes from DevShell'
name: "Test with Flakes from DevShell"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -142,16 +142,16 @@ jobs:
# FAQ: Passing a Github Token against Rate Limits

```yaml
name: 'Test'
name: "Test"
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
Expand All @@ -173,6 +173,9 @@ See

# Hacking

Built with [Rollup](https://rollupjs.org/) (ESM) and TypeScript. Run
`npm run package` to rebuild `dist/`.

See https://github.com/actions/typescript-action

[nix]: https://nixos.org/nix/
Expand Down
14 changes: 0 additions & 14 deletions __tests__/main.test.ts

This file was deleted.

39 changes: 19 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
name: 'Nix Shell'
description:
'Run any command you like in a deterministic nix shell on Linux and macOS'
author: '@workflow'
name: "Nix Shell"
description: "Run any command you like in a deterministic nix shell on Linux and macOS"
author: "@workflow"
inputs:
interpreter:
required: false
description: 'Interpreter to use in the nix shell shebang'
default: 'bash'
description: "Interpreter to use in the nix shell shebang"
default: "bash"
packages:
required: false
description:
'Comma-separated list of packages to pre-install in your shell. Defaults
to simply "bash". Cannot be used together with the flakes option'
default: 'bash'
default: "bash"
flakes:
required: false
description:
'Comma-separated list of fully qualified flakes to pre-install in your
"Comma-separated list of fully qualified flakes to pre-install in your
shell. Use either packages or flakes. Cannot be used together with the
packages option'
default: ''
packages option"
default: ""
flakes-from-devshell:
required: false
description: 'If set to true, uses devShell instead.'
description: "If set to true, uses devShell instead."
default: false
custom-devshell:
required: false
description: 'If set, uses a customly named devShell from the current flake'
default: ''
description: "If set, uses a customly named devShell from the current flake"
default: ""
script:
required: true
description: 'The actual script to execute in the shell'
description: "The actual script to execute in the shell"
working-directory:
required: false
description:
'Execute the script inside the specified working directory instead of the
repository root. Example: path/to/dir'
"Execute the script inside the specified working directory instead of the
repository root. Example: path/to/dir"

branding:
color: 'blue'
icon: 'chevron-right'
color: "blue"
icon: "chevron-right"
runs:
using: 'node20'
main: 'dist/index.js'
using: "node24"
main: "dist/index.js"
Loading
Loading