Skip to content

Commit

Permalink
style: format code with prettier (#1474)
Browse files Browse the repository at this point in the history
* chore: set up prettier

* style: format code with prettier

```sh
npm run fmt
```

* chore(aqua): update aqua-checksums.json

---------

Co-authored-by: suzuki-shunsuke-app[bot] <91834585+suzuki-shunsuke-app[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 6296b6e commit 766a6c6
Show file tree
Hide file tree
Showing 53 changed files with 842 additions and 608 deletions.
38 changes: 19 additions & 19 deletions .cmdx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# cmdx - task runner
# https://github.com/suzuki-shunsuke/cmdx
tasks:
- name: release
short: r
description: release the new version
usage: release the new version
script: gh workflow run release.yaml -f tag={{.version}}
args:
- name: version
required: true
validate:
- regexp: "^v\\d+\\.\\d+.\\d+(-\\d+)?$"
- name: schema
description: build JSON Schema
usage: build JSON Schema
require:
exec:
- generate-schema-doc
script: |
mkdir -p build
generate-schema-doc --expand-buttons --link-to-reused-ref schema build
- name: release
short: r
description: release the new version
usage: release the new version
script: gh workflow run release.yaml -f tag={{.version}}
args:
- name: version
required: true
validate:
- regexp: "^v\\d+\\.\\d+.\\d+(-\\d+)?$"
- name: schema
description: build JSON Schema
usage: build JSON Schema
require:
exec:
- generate-schema-doc
script: |
mkdir -p build
generate-schema-doc --expand-buttons --link-to-reused-ref schema build
2 changes: 1 addition & 1 deletion .github/workflows/create-pr-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
pr:
description: 'Pull Request Number'
description: "Pull Request Number"
required: true
jobs:
create-pr-branch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prerelease-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'tag'
description: "tag"
required: true
pr:
description: 'pr number'
description: "pr number"
required: true
permissions:
contents: write
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'tag'
description: "tag"
required: true
ref:
description: 'released ref (branch, tag or SHA). By default, the default branch is used'
description: "released ref (branch, tag or SHA). By default, the default branch is used"
required: false
default: ''
default: ""
permissions:
contents: write
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wc-create-pr-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
pr:
description: 'Pull Request Number'
description: "Pull Request Number"
required: true
type: number
secrets:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/wc-test-get-target-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
env:
TFACTION_CONFIG: get-target-config/tests/config-1.yaml
TFACTION_TARGET: aws/foo
TFACTION_IA_APPLY: 'false'
TFACTION_JOB_TYPE: 'terraform'
TFACTION_IA_APPLY: "false"
TFACTION_JOB_TYPE: "terraform"
- run: echo "${{ steps.target-config.outputs.working_directory }}"
- run: echo "${{ steps.target-config.outputs.aws_assume_role_arn }}"
- run: echo "${{ steps.target-config.outputs.aws_region }}"
Expand All @@ -38,8 +38,8 @@ jobs:
env:
TFACTION_CONFIG: get-target-config/tests/config-1.yaml
TFACTION_TARGET: gcp/foo
TFACTION_IA_APPLY: 'false'
TFACTION_JOB_TYPE: 'terraform'
TFACTION_IA_APPLY: "false"
TFACTION_JOB_TYPE: "terraform"
- run: echo "${{ steps.target-config.outputs.working_directory }}"
- run: echo "${{ steps.target-config.outputs.gcs_bucket_name_plan_file }}"
- run: echo "${{ steps.target-config.outputs.gcs_bucket_name_tfmigrate_history }}"
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist
2 changes: 1 addition & 1 deletion apply/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: apply
description: apply
inputs:
github_token:
description: 'GitHub Access Token'
description: "GitHub Access Token"
required: false
default: ${{ github.token }}
runs:
Expand Down
4 changes: 2 additions & 2 deletions aqua-checksums.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@
"algorithm": "sha256"
},
{
"id": "registries/github_content/github.com/aquaproj/aqua-registry/v4.123.0/registry.yaml",
"checksum": "3233193BCB7603A6B1971904F46D8B02A56A596474ABF500B85D7CF44C3550BF",
"id": "registries/github_content/github.com/aquaproj/aqua-registry/v4.125.0/registry.yaml",
"checksum": "DA06A84ABB50412A8EE1E7D0DD767317F74111DF7C9C6608DF0B3EAE5D223748",
"algorithm": "sha256"
}
]
Expand Down
2 changes: 1 addition & 1 deletion aqua/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages:
- name: rhysd/[email protected]
- name: rhysd/[email protected]
10 changes: 5 additions & 5 deletions check-terraform-skip/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Check if terraform plan and apply are skipped
description: Check if terraform plan and apply are skipped
inputs:
labels:
description: 'Labels File'
description: "Labels File"
required: true
skip_label_prefix:
description: 'Skip Label Prefix'
description: "Skip Label Prefix"
required: true
pr_author:
description: 'Pull Request Author'
description: "Pull Request Author"
required: true
outputs:
skip_terraform:
description: whether terraform is skipped
runs:
using: 'node20'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
38 changes: 25 additions & 13 deletions check-terraform-skip/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import * as core from '@actions/core';
import * as fs from 'fs';
import * as lib from './lib';
import * as core from "@actions/core";
import * as fs from "fs";
import * as lib from "./lib";

function getSkipTerraform(): boolean {
const config = lib.getConfig();
const renovateLogin = config.renovate_login ? config.renovate_login : 'renovate[bot]';
const skipLabelPrefix = core.getInput('skip_label_prefix', { required: true });
const labels = fs.readFileSync(core.getInput('labels', { required: true }), 'utf8').split('\n');
const renovateLogin = config.renovate_login
? config.renovate_login
: "renovate[bot]";
const skipLabelPrefix = core.getInput("skip_label_prefix", {
required: true,
});
const labels = fs
.readFileSync(core.getInput("labels", { required: true }), "utf8")
.split("\n");
const target = process.env.TFACTION_TARGET;
if (!target) {
throw 'TFACTION_TARGET is required';
throw "TFACTION_TARGET is required";
}
if (renovateLogin != core.getInput('pr_author', { required: true })) {
if (renovateLogin != core.getInput("pr_author", { required: true })) {
for (let i = 0; i < labels.length; i++) {
if (labels[i] == `${skipLabelPrefix}${target}` ) {
if (labels[i] == `${skipLabelPrefix}${target}`) {
return true;
}
}
Expand All @@ -22,7 +28,11 @@ function getSkipTerraform(): boolean {
if (!config.skip_terraform_by_renovate) {
return false;
}
const renovateTerraformLabels = new Set(config.renovate_terraform_labels ? config.renovate_terraform_labels : ['terraform']);
const renovateTerraformLabels = new Set(
config.renovate_terraform_labels
? config.renovate_terraform_labels
: ["terraform"],
);
for (let i = 0; i < labels.length; i++) {
const label = labels[i];
if (renovateTerraformLabels.has(label)) {
Expand All @@ -35,8 +45,10 @@ function getSkipTerraform(): boolean {

try {
const isSkip = getSkipTerraform();
core.exportVariable('TFACTION_SKIP_TERRAFORM', isSkip);
core.setOutput('skip_terraform', isSkip);
core.exportVariable("TFACTION_SKIP_TERRAFORM", isSkip);
core.setOutput("skip_terraform", isSkip);
} catch (error) {
core.setFailed(error instanceof Error ? error.message : JSON.stringify(error));
core.setFailed(
error instanceof Error ? error.message : JSON.stringify(error),
);
}
16 changes: 8 additions & 8 deletions check-terraform-skip/src/lib.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as fs from 'fs';
import * as fs from "fs";

const yaml = require('js-yaml');
const yaml = require("js-yaml");

interface Config {
renovate_login: string | undefined
skip_terraform_by_renovate: boolean | undefined
renovate_terraform_labels: Array<string> | undefined
renovate_login: string | undefined;
skip_terraform_by_renovate: boolean | undefined;
renovate_terraform_labels: Array<string> | undefined;
}

export function getConfig(): Config {
let configFilePath = process.env.TFACTION_CONFIG;
if (configFilePath == '' || configFilePath == undefined) {
configFilePath = 'tfaction-root.yaml';
if (configFilePath == "" || configFilePath == undefined) {
configFilePath = "tfaction-root.yaml";
}
return yaml.load(fs.readFileSync(configFilePath, 'utf8'));
return yaml.load(fs.readFileSync(configFilePath, "utf8"));
}
2 changes: 1 addition & 1 deletion create-follow-up-pr/github-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ post:
## {{if .Vars.tfaction_target}}{{.Vars.tfaction_target}}: {{end}}Please create a follow up pull request
{{template "link" .}}
{{.Vars.mentions}}
Apply failed. Please handle the problem. **:warning: Don't rerun GitHub Actions Workflow**
Expand Down
2 changes: 1 addition & 1 deletion create-scaffold-module-pr/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ runs:
cat << EOS >> "$GITHUB_STEP_SUMMARY"
## Create a pull request
Please run the following command in your terminal.
$CODE_BLOCK
Expand Down
2 changes: 1 addition & 1 deletion create-scaffold-pr/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ runs:
cat << EOS >> "$GITHUB_STEP_SUMMARY"
## Create a scaffold pull request
Please run the following command in your terminal.
$CODE_BLOCK
Expand Down
4 changes: 2 additions & 2 deletions deploy-ssh-key/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Deploy SSH Key
description: Deploy SSH Key
inputs:
ssh_key:
description: 'SSH Key'
description: "SSH Key"
required: true
ssh_key_path:
description: 'SSH Key'
description: "SSH Key"
required: false
default: $HOME/.ssh/id_rsa
runs:
Expand Down
4 changes: 2 additions & 2 deletions export-aws-secrets-manager/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Exports AWS Secrets Manager's secrets as environment variables
description: Exports AWS Secrets Manager's secrets as environment variables
runs:
using: 'node20'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
12 changes: 7 additions & 5 deletions export-aws-secrets-manager/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as core from '@actions/core';
import { run } from './run'
import * as core from "@actions/core";
import { run } from "./run";

const main = async (): Promise<void> => {
await run()
}
await run();
};

main().catch((e) => core.setFailed(e instanceof Error ? e.message : JSON.stringify(e)))
main().catch((e) =>
core.setFailed(e instanceof Error ? e.message : JSON.stringify(e)),
);
Loading

0 comments on commit 766a6c6

Please sign in to comment.