diff --git a/.gitignore b/.gitignore index 18e337d..d734171 100644 --- a/.gitignore +++ b/.gitignore @@ -96,4 +96,7 @@ Thumbs.db # Ignore built ts files __tests__/runner/* -lib/**/* \ No newline at end of file +lib/**/* + +# JetBrains config +.idea diff --git a/README.md b/README.md index 25ac697..2d4eb60 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ steps: registry: ${{secrets.YOUR_REGISTRY}} username: ${{secrets.YOUR_USERNAME}} password: ${{secrets.YOUR_PASSWORD}} + local: false - run: | acorn build . # Whatever you want to do with acorn ``` @@ -26,6 +27,7 @@ steps: | `registry` | **Required** | Registry address to login to (e.g. ghcr.io or docker.io) | `username` | **Required** | Registry username | `password` | **Required** | Registry password +| `local` | 'false' | Adds the `--local-storage` argument to `acorn login` if set to 'true' # License diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index b238346..c4cbeb0 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -22,8 +22,9 @@ test('loginStandard calls exec', async () => { const username = 'hello' const password = 'world' + const local = false - await login(registry, username, password) + await login(registry, username, password, local) expect(execSpy).toHaveBeenCalledWith( `acorn`, diff --git a/action.yml b/action.yml index dade49e..25345d7 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: password: description: Password required: true + local: + description: "Adds the `--local-storage` argument to `acorn login` if set to 'true'" + required: false + default: 'false' runs: using: 'node16' main: 'dist/index.js' diff --git a/src/login.ts b/src/login.ts index f87c04e..74a7335 100644 --- a/src/login.ts +++ b/src/login.ts @@ -4,7 +4,8 @@ import * as exec from '@actions/exec' export async function login( registry: string, username: string, - password: string + password: string, + local: boolean, ): Promise { if (!registry || !username || !password) { throw new Error('Registry, username, and password required') @@ -12,6 +13,10 @@ export async function login( const args = ['login', '--password-stdin', '--username', username, registry] + if (local) { + args.push('--local-storage') + } + core.info(`Logging into ${registry}...`) const res = await exec.getExecOutput('acorn', args, { diff --git a/src/main.ts b/src/main.ts index 1d6ec5a..42a2ffc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,9 +5,10 @@ async function setup(): Promise { const registry = core.getInput('registry') const username = core.getInput('username') const password = core.getInput('password') + const local= core.getInput('local') === 'true' core.saveState('registry', registry) - await login(registry, username, password) + await login(registry, username, password, local) } async function teardown(): Promise {