Skip to content
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
3 changes: 1 addition & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

`Release GitHub Actions` の CLIツール
[Release GitHub Actions](https://github.com/technote-space/release-github-actions) をラップしたものです。
[Release GitHub Actions](https://github.com/technote-space/release-github-actions) の CLIツール

## Table of Contents

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

CLI tool of `Release GitHub Actions`.
Wrapper of [Release GitHub Actions](https://github.com/technote-space/release-github-actions).
CLI tool of [Release GitHub Actions](https://github.com/technote-space/release-github-actions).

## Table of Contents

Expand Down
46 changes: 28 additions & 18 deletions __tests__/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/* eslint-disable no-magic-numbers */
import { resolve } from 'path';
import { getParams } from '@technote-space/release-github-actions/lib/utils/misc';
import { normalizeConfigKey, normalizeConfigKeys, getActionDefaultInputs, getConfig } from '../src/config';

const fixturesDir = resolve(__dirname, 'fixtures');
beforeEach(() => {
getParams.clear();
});

describe('normalizeConfigKey', () => {
it('should normalize config key', () => {
Expand Down Expand Up @@ -32,18 +36,19 @@ describe('normalizeConfigKeys', () => {
describe('getActionDefaultInputs', () => {
it('should get inputs', () => {
expect(getActionDefaultInputs()).toEqual({
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '3',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand All @@ -56,18 +61,19 @@ describe('getConfig', () => {
it('should get config 1', () => {
expect(getConfig(resolve(fixturesDir, 'test7'), undefined)).toEqual({
'inputs': {
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '5',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand All @@ -82,18 +88,19 @@ describe('getConfig', () => {
it('should get config 2', () => {
expect(getConfig(resolve(fixturesDir, 'test8'), false)).toEqual({
'inputs': {
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '3',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand All @@ -107,18 +114,19 @@ describe('getConfig', () => {
it('should get config 3', () => {
expect(getConfig(resolve(fixturesDir, 'test9'), true)).toEqual({
'inputs': {
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}, gh-actions',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '3',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand All @@ -132,18 +140,19 @@ describe('getConfig', () => {
it('should get config 4', () => {
expect(getConfig(resolve(fixturesDir, 'test10'), undefined)).toEqual({
'inputs': {
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '3',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand All @@ -157,18 +166,19 @@ describe('getConfig', () => {
it('should get config 5', () => {
expect(getConfig(resolve(fixturesDir, 'test12'), undefined)).toEqual({
'inputs': {
'BRANCH_NAME': 'gh-actions',
'BRANCH_NAME': 'releases/${MAJOR}',
'BUILD_COMMAND': '',
'BUILD_COMMAND_TARGET': '',
'BUILD_COMMAND_TARGET': 'build,production,prod,package',
'CLEAN_TARGETS': '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml',
'CLEAN_TEST_TAG': 'false',
'COMMIT_EMAIL': '41898282+github-actions[bot]@users.noreply.github.com',
'COMMIT_MESSAGE': 'feat: Build for release',
'COMMIT_MESSAGE': 'feat: build for release',
'COMMIT_NAME': 'github-actions[bot]',
'CREATE_MAJOR_VERSION_TAG': 'true',
'CREATE_MINOR_VERSION_TAG': 'true',
'CREATE_PATCH_VERSION_TAG': 'true',
'FETCH_DEPTH': '3',
'GITHUB_TOKEN': '${{ github.token }}',
'ORIGINAL_TAG_PREFIX': '',
'OUTPUT_BUILD_INFO_FILENAME': '',
'PACKAGE_MANAGER': '',
Expand Down
4 changes: 4 additions & 0 deletions __tests__/env.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable no-magic-numbers */
import { resolve } from 'path';
import { testEnv } from '@technote-space/github-action-test-helper';
import { getParams } from '@technote-space/release-github-actions/lib/utils/misc';
import { setEnv, loadTokenFromEnv } from '../src/env';

const fixturesDir = resolve(__dirname, 'fixtures');
beforeEach(() => {
getParams.clear();
});

describe('setEnv', () => {
testEnv();
Expand Down
Loading