Skip to content

Commit

Permalink
♻️ refactor(project): general (#8)
Browse files Browse the repository at this point in the history
## 💌 Description

<!-- Add a more detailed description of the changes if needed. -->

## 🔗 Related issue

<!-- If your PR refers to a related issue, link it here. -->
Close: #

## 🔄️ Type of change

<!-- Mark with an `x` all the checkboxes that apply (like `[x]`) -->

- [ ] 📝 Examples, docs, tutorials
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [x] 🥂 Improvement (non-breaking change which improves an existing
feature)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] 🔒 Security fix
- [x] ⬆️ Dependencies update

## ✔️ Checklist

<!-- Mark with an `x` all the checkboxes (like `[x]`) -->

- [x] I've read the [`Code of
Conduct`](../blob/main/.github/CODE_OF_CONDUCT.md) document.
- [x] I've read the
[`Contributing`](../blob/main/.github/CONTRIBUTING.md) guide.
  • Loading branch information
DariuszPorowski authored Jun 2, 2023
1 parent 71f2ef8 commit f9b5662
Show file tree
Hide file tree
Showing 26 changed files with 1,450 additions and 499 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.ts]
max_line_length = 120

[*.{cmd,bat}]
end_of_line = crlf
15 changes: 10 additions & 5 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
root: true

plugins:
- github
- jest
- '@typescript-eslint'
- prettier
extends:
- plugin:github/recommended
- plugin:jest/recommended
- plugin:@typescript-eslint/recommended
- plugin:prettier/recommended
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 9
sourceType: module
project: ./tsconfig.json
rules:
semi: off
i18n-text/no-en: off
eslint-comments/no-use: off
import/no-namespace: off
no-unused-vars: off
'@typescript-eslint/no-unused-vars': error
'@typescript-eslint/explicit-member-accessibility':
- error
Expand Down Expand Up @@ -60,16 +60,21 @@ rules:
- never
'@typescript-eslint/type-annotation-spacing': error
'@typescript-eslint/unbound-method': error
prettier/prettier:
- error
- {}
- usePrettierrc: true
overrides:
- files:
- './**/*.test.ts'
- './**/*.spec.ts'
- './tests/setup.ts'
- './tests/helpers.ts'
- 'node_modules/**'
rules:
'@typescript-eslint/no-explicit-any': off
env:
node: true
es2018: true
es2020: true
jest/globals: true
jest: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ build/Release
# Dependency directories
node_modules/
jspm_packages/
.yarn/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# yaml-language-server: $schema=https://json.schemastore.org/prettierrc
---
printWidth: 180
printWidth: 120
tabWidth: 2
endOfLine: lf
useTabs: false
semi: false
singleQuote: true
trailingComma: none
bracketSpacing: false
bracketSpacing: true
arrowParens: avoid
endOfLine: lf
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"git.followTagsWhenSync": true,
"git.branchProtection": [
"main",
"master",
"master"
],
"git.mergeEditor": true,
"git.enableSmartCommit": true,
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ Abc123

## 📥 Inputs

| Name | Type | Required | Default | Description |
|:--------------:|:--------:|:--------:|:--------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `github-token` | `string` | `true` | *not set* | GitHub token to use for API authentication with `environment:read`. scope. |
| `environment` | `string` | `true` | *not set* | Deployment Environment name. |
| `output-to` | `string` | `false` | `all` | Output type. One of:<br/>- `action` returns variables as action output<br/>- `env` returns variables as environment variables<br/>- `all` action output + envvars. |
| `env-prefix` | `string` | `false` | *not set* | Prefix for environment variables. Environment variables prefix will be upper-cased and striped from any special characters. A double underscore `__` is placed between environment prefix and env name (`MYPREFIX__VAR`). |
| `repository` | `string` | `false` | `github.repository` | To fetch variables from Deployment Environment placed in different repository, set full repository name in the `owner/repo` format. |
| Name | Type | Required | Default | Description |
|:--------------:|:---------:|:--------:|:-------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `github-token` | `string` | `true` | _not set_ | GitHub token to use for API authentication with `environment:read`. scope. |
| `environment` | `string` | `true` | _not set_ | Deployment Environment name. |
| `output-to` | `string` | `false` | `all` | Output type. One of:<br/>- `action` returns variables as action output<br/>- `env` returns variables as environment variables<br/>- `all` action output + envvars. |
| `env-prefix` | `string` | `false` | _not set_ | Prefix for environment variables. Environment variables prefix will be upper-cased and striped from any special characters. A double underscore `__` is placed between environment prefix and env name (`MYPREFIX__VAR`). |
| `repository` | `string` | `false` | `github.repository` | To fetch variables from Deployment Environment placed in different repository, set full repository name in the `owner/repo` format. |
| `dry-run` | `boolean` | `false` | `false` | Whether or not to actually perform operation. Set to `true` for testing. Will not set outputs/envvars - just log entries. |

## 📤 Outputs

Expand Down
30 changes: 24 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,47 @@ branding:
color: gray-dark

inputs:
# required
github-token:
description: GitHub token to use for API authentication with environment:read scope.
description: GitHub token to use for API authentication
required: true
default: ${{ github.token }}

environment:
description: Deployment Environment name.
required: true

# optional
repository:
description: |
Full repository name in the {owner}/{repo} format.
Default: github.repository
required: false
default: ${{ github.repository }}

output-to:
description: |
Output to...
Default: all
Supported options:
- env: Set environment variables
- action: Set action outputs
- all: Set both environment variables and action outputs
Default: all
required: false
default: 'all'

env-prefix:
description: Prefix for environment variables.
description: |
Prefix for environment variables.
Default: not set
required: false
repository:

dry-run:
description: |
Full repository name in the {owner}/{repo} format.
Default: current repository
Whether or not to actually perform operation. Set to true for testing.
Default: false
required: false
default: 'false'

runs:
using: node16
Expand Down
16 changes: 8 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ module.exports = {
setupFiles: [
'<rootDir>/tests/setup.ts'
],
coveragePathIgnorePatterns: [
'<rootDir>/lib/',
'/node_modules/'
],
clearMocks: true,
moduleFileExtensions: [
'ts',
Expand Down Expand Up @@ -36,15 +32,19 @@ module.exports = {
'<rootDir>/src/**/*.ts',
'<rootDir>/src/**/*.js'
],
coveragePathIgnorePatterns: [
'<rootDir>/lib/',
'/node_modules/'
],
coverageDirectory: 'coverage',
coverageReporters: ['clover', 'json', 'lcov', 'text', 'text-summary', 'cobertura'],
coverageThreshold: {
global: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: -10,
branches: 90,
functions: 90,
lines: 90,
statements: 90,
}
}
}
Expand Down
Loading

0 comments on commit f9b5662

Please sign in to comment.