Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #3

Merged
merged 4 commits into from
Jan 25, 2024
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc.json

This file was deleted.

15 changes: 15 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":dependencyDashboard",
":dependencyDashboardApproval"
],
"packageRules": [
{
"allowedVersions": "/^(18)\\./",
"groupName": "Node.js",
"matchPackageNames": ["@types/node", "node"]
}
]
}
1 change: 0 additions & 1 deletion .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Build'
on: # rebuild any PRs and main branch changes
name: Build
on:
pull_request:
push:
branches:
Expand Down Expand Up @@ -58,5 +58,5 @@ jobs:
env_file: .github/.env

- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
run: |
echo "EXAMPLE: $EXAMPLE"
10 changes: 5 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
analyze:
Expand All @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'TypeScript' ]
language: [TypeScript]

steps:
- name: Checkout repository
Expand All @@ -34,4 +34,4 @@ jobs:
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
### Basic

```yaml
steps:
- uses: actions/checkout@v3
- name: Run
uses: rotki/action-env@v1
with:
env_file: .github/.env
- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
```
steps:
- uses: actions/checkout@v3
- name: Run
uses: rotki/action-env@v1
with:
env_file: .github/.env
- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
```
17 changes: 9 additions & 8 deletions __tests__/main.test.ts
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 '@jest/globals';
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());
});
10 changes: 5 additions & 5 deletions action.yml
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
1 change: 0 additions & 1 deletion commitlint.config.js
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'],
};
Loading