-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
696 additions
and
316 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
import * as process from 'process'; | ||
import * as cp from 'child_process'; | ||
import * as path from 'path'; | ||
import { expect, test } from 'vitest'; | ||
import * as process from 'node:process'; | ||
import * as cp from 'node:child_process'; | ||
import * as path from 'node:path'; | ||
import { expect, it } from 'vitest'; | ||
import { loadEnv } from '../src/file'; | ||
|
||
test('loads from env file if the file exists', async () => { | ||
it('loads from env file if the file exists', () => { | ||
expect(loadEnv('.github/.env')).toMatchObject({ EXAMPLE: 'example' }); | ||
}); | ||
|
||
test('returns undefined if the env file does not exist', async () => { | ||
it('returns undefined if the env file does not exist', () => { | ||
expect(loadEnv('.unknown_env')).toBeUndefined(); | ||
}); | ||
|
||
// shows how the runner will run a javascript action with env / stdout protocol | ||
test('test runs', () => { | ||
process.env['INPUT_ENV_FILE'] = '.github/.env'; | ||
it('test runs', () => { | ||
process.env.INPUT_ENV_FILE = '.github/.env'; | ||
const np = process.execPath; | ||
const ip = path.join(__dirname, '..', 'lib', 'main.js'); | ||
const options: cp.ExecFileSyncOptions = { | ||
env: process.env, | ||
}; | ||
// eslint-disable-next-line no-console | ||
console.log(cp.execFileSync(np, [ip], options).toString()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name: '@rotki/action-env' | ||
description: 'Loads environment variables for a job from a file' | ||
author: 'Rotki Solutions GmbH' | ||
description: Loads environment variables for a job from a file | ||
author: Rotki Solutions GmbH | ||
inputs: | ||
env_file: | ||
required: true | ||
description: 'The path to the environment file where the variables will be loaded from' | ||
description: The path to the environment file where the variables will be loaded from | ||
runs: | ||
using: 'node20' | ||
main: 'dist/index.js' | ||
using: node20 | ||
main: dist/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const rotki = require('@rotki/eslint-config').default; | ||
const github = require('eslint-plugin-github'); | ||
|
||
module.exports = rotki({ | ||
typescript: { | ||
tsconfigPath: 'tsconfig.eslint.json', | ||
}, | ||
stylistic: true, | ||
formatters: true, | ||
}, { | ||
files: ['src/**/*.ts'], | ||
plugins: { | ||
github, | ||
}, | ||
rules: { | ||
'github/array-foreach': 'error', | ||
'github/no-implicit-buggy-globals': 'error', | ||
'github/no-then': 'error', | ||
'github/no-dynamic-script-tag': 'error', | ||
}, | ||
}, { | ||
files: ['**/*.ts'], | ||
rules: { | ||
'perfectionist/sort-objects': 'error', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,37 +2,35 @@ | |
"name": "@rotki/action-env", | ||
"version": "2.0.0", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"description": "Loads environment variables from a .env file", | ||
"keywords": [ | ||
"actions", | ||
"node", | ||
"setup" | ||
], | ||
"license": "AGPL-3.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rotki/action-env.git" | ||
}, | ||
"author": "Rotki Solutions GmbH <[email protected]>", | ||
"main": "lib/main.js", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "tsc", | ||
"format": "prettier --write '**/*.ts'", | ||
"format-check": "prettier --check '**/*.ts'", | ||
"lint": "eslint src/**/*.ts", | ||
"lint": "eslint .", | ||
"package": "ncc build --source-map --license licenses.txt", | ||
"test": "vitest", | ||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test", | ||
"all": "npm run build && npm run lint && npm run package && npm test", | ||
"preinstall": "npx only-allow pnpm", | ||
"release": "bumpp --no-push" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/rotki/action-env.git" | ||
}, | ||
"keywords": [ | ||
"actions", | ||
"node", | ||
"setup" | ||
], | ||
"author": "Rotki Solutions GmbH <[email protected]>", | ||
"license": "AGPL-3.0", | ||
"dependencies": { | ||
"@actions/core": "1.10.1", | ||
"dotenv": "16.4.1" | ||
}, | ||
"devDependencies": { | ||
"@rotki/eslint-config": "1.1.2", | ||
"@rotki/eslint-config": "2.4.4", | ||
"@types/node": "20.11.6", | ||
"@vercel/ncc": "0.38.1", | ||
"bumpp": "9.3.0", | ||
|
Oops, something went wrong.