Skip to content

Commit

Permalink
feat: Add default github-token input support
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer committed Feb 7, 2024
1 parent 9935e97 commit e84d9ba
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/full-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-22.04, macos-latest]
ver: [0.88.1, 0.87.1, 0.86]
ver: [0.90.1, 0.88.1, 0.87.1, 0.86]

runs-on: ${{ matrix.os }}
name: test (${{matrix.os}}, nu@${{matrix.ver}})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/latest-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-22.04, macos-latest]
ver: [0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, 0.82, '0.80', 0.79, 0.78, 0.77.1, 0.75, 0.73, 0.72, 0.71, '0.70', 0.69.1]
ver: [0.90.1, 0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, 0.82, '0.80', 0.79, 0.78, 0.77.1, 0.75, 0.73, 0.72, 0.71, '0.70']

runs-on: ${{ matrix.os }}
name: test (${{matrix.os}}, nu@${{matrix.ver}})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/module-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
ver: [0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, 0.82, '0.80', 0.79, 0.78, 0.77.1, 0.76, 0.75, 0.74, 0.73, 0.72.1, 0.71, '0.70', 0.69.1]
ver: [0.90.1, 0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, 0.82, '0.80', 0.79, 0.78, 0.77.1, 0.76, 0.75, 0.74, 0.73, 0.72.1, 0.71, '0.70']

runs-on: ${{ matrix.os }}
name: test (${{matrix.os}}, nu@${{matrix.ver}})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/module-test2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04, macos-latest]
ver: [0.87.1, 0.86, 0.85]
ver: [0.90.1, 0.87.1, 0.86, 0.85]

runs-on: ${{ matrix.os }}
name: test (${{matrix.os}}, nu@${{matrix.ver}})
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-22.04, macos-latest]
ver: [0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, '0.80', 0.79, 0.78, 0.77.1, 0.75, 0.73, 0.72, 0.71, '0.70', 0.69.1, 0.68, 0.67]
ver: [0.90.1, 0.88.1, 0.87.1, 0.86, 0.85, 0.83.1, '0.80', 0.79, 0.78, 0.77.1, 0.75, 0.73, 0.72, 0.71, '0.70', 0.69.1, 0.68]

runs-on: ${{ matrix.os }}
name: test (${{matrix.os}}, nu@${{matrix.ver}})
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ To use modules in `Nu`, please refer to the following examples:
- name: Setup nu
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Use Your Nu Modules
Expand All @@ -96,7 +96,7 @@ You have to wrap the `nu` code in `nu -c ""`, and the nu version should be equal
- name: Setup nu
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Use Your Nu Modules by Absolute Path
Expand All @@ -115,7 +115,7 @@ Again, the nu version should be equal to or above `0.69`.
- name: Setup nu@latest
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Nu Modules
Expand Down Expand Up @@ -200,6 +200,7 @@ If this happens you can set the `GITHUB_TOKEN` environment variable.
| `check-latest` | no | Set to `true` if you want to use the latest version | bool | false |
| `enable-plugins` | no | Set to `true` if you want to register the bundled plugins, Nu v0.69 and above is required | bool | false |
| `features` | no | Available choice: `default` or `full`, and the `full` features will include the commands from `extra` and `dataframe`. This option support `Nu` since `v0.86` | string | `default` |
| `github-token` | no | Your GitHub token or PAT token | string | `${{ github.token }}` |

The semver specification is passed directly to NPM's [semver package](https://www.npmjs.com/package/semver).
This GitHub Action will install the latest matching release.
Expand Down
7 changes: 4 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Setup nu
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Use Your Nu Modules
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Setup nu
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Use Your Nu Modules by Absolute Path
Expand All @@ -110,7 +110,7 @@ jobs:
- name: Setup nu@latest
uses: hustcer/[email protected]
with:
version: 0.87.1
version: 0.90.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Nu Modules
Expand Down Expand Up @@ -191,6 +191,7 @@ jobs:
| `check-latest` | 否 | 可以设置为 `true` 如果你想使用最新的 Nushell 版本 | bool | false |
| `enable-plugins` | 否 | 可以设置为 `true` 如果你需要注册二进制包内的插件, 需要 Nu 版本 >= v0.69 | bool | false |
| `features` | 否 | 可选项: `default`,`full`, 设置为 `full` 将包含 `extra` 和 `dataframe` 中的命令, 该选项支持 `Nu` `v0.86` 及以后版本 | string | `default` |
| `github-token` | 否 | 你的 GitHub Token 或者 PAT token | string | `${{ github.token }}` |

您在 `version` 字段指定的 **semver 版本** 会直接传递给 NPM 的 [semver 包](https://www.npmjs.com/package/semver)。此 GitHub Action 将安装最新的匹配版本。

Expand Down
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ inputs:
default: false
required: false
description: 'Enable registering of plugins'
github-token:
description: 'GitHub token or PAT token'
required: false
default: ${{ github.token }}

runs:
using: 'node20'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "setup-nu",
"version": "3.8.0",
"actionVer": "v3.8",
"version": "3.9.0",
"actionVer": "v3.9",
"description": "A Github Action to Setup a Nushell Environment to Run Nu Scripts or Commands",
"main": "dist/index.js",
"private": true,
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ async function main() {
const checkLatest = (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
const enablePlugins = (core.getInput('enable-plugins') || 'false').toUpperCase() === 'TRUE';
const features = core.getInput('features') || 'default';
const githubToken = core.getInput('github-token');
const version = ['*', 'nightly'].includes(versionSpec) ? versionSpec : semver.valid(semver.coerce(versionSpec));
console.log(`coerce version: ${version}`);
const ver = version === null ? undefined : version;
if (!ver) {
core.setFailed(`Invalid version: ${versionSpec}`);
}

core.exportVariable('GITHUB_TOKEN', githubToken);
const tool = await setup.checkOrInstallTool({
checkLatest,
enablePlugins,
Expand Down

0 comments on commit e84d9ba

Please sign in to comment.