From e033a87d058ae2f44d263be4dc94a60d19d9ba9b Mon Sep 17 00:00:00 2001 From: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:53:49 +0900 Subject: [PATCH] =?UTF-8?q?super-linter=E3=82=A2=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=83=87=E3=83=BC=E3=83=88=20(#1526)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update super-linter/super-linter action to v6.8.0 * super-linterによる指摘事項修正 * prettierを使う * gitleaksをアップデートしてあげたよ! (#1527) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/super-linter.yml | 4 ++- .pre-commit-config.yaml | 2 +- scripts/action/create_release.js | 10 +++--- scripts/action/increment_version.js | 51 ++++++++++++++++------------- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 498386580..9ed63ad67 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -52,12 +52,14 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: super-linter/super-linter/slim@v6.7.0 + uses: super-linter/super-linter/slim@v6.8.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEFAULT_BRANCH: main LINTER_RULES_PATH: . VALIDATE_JSCPD: false + JAVASCRIPT_DEFAULT_STYLE: prettier + VALIDATE_JAVASCRIPT_STANDARD: false concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} cancel-in-progress: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 005488935..93d7490b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ --- repos: - repo: https://github.com/zricethezav/gitleaks - rev: v8.18.3 + rev: v8.18.4 hooks: - id: gitleaks diff --git a/scripts/action/create_release.js b/scripts/action/create_release.js index 4f9e7fdfe..225343107 100644 --- a/scripts/action/create_release.js +++ b/scripts/action/create_release.js @@ -4,8 +4,8 @@ module.exports = async ({ github, context }) => { repo: context.repo.repo, tag_name: process.env.TAG_NAME, target_commitish: process.env.GITHUB_REF, - generate_release_notes: true - } - console.log('call repos.createRelease:', createReleaseParams) - await github.rest.repos.createRelease(createReleaseParams) -} + generate_release_notes: true, + }; + console.log("call repos.createRelease:", createReleaseParams); + await github.rest.repos.createRelease(createReleaseParams); +}; diff --git a/scripts/action/increment_version.js b/scripts/action/increment_version.js index b259ed177..c268bc92a 100644 --- a/scripts/action/increment_version.js +++ b/scripts/action/increment_version.js @@ -1,43 +1,48 @@ module.exports = async ({ github, context }) => { - let latestReleaseVersion = '' + let latestReleaseVersion = ""; try { const getLatestReleaseParams = { owner: context.repo.owner, - repo: context.repo.repo - } - console.log('call repos.getLatestRelease:', getLatestReleaseParams) - const latestRelease = await github.rest.repos.getLatestRelease(getLatestReleaseParams) - latestReleaseVersion = latestRelease.data.tag_name + repo: context.repo.repo, + }; + console.log("call repos.getLatestRelease:", getLatestReleaseParams); + const latestRelease = await github.rest.repos.getLatestRelease( + getLatestReleaseParams, + ); + latestReleaseVersion = latestRelease.data.tag_name; } catch (e) { if (e.status === 404) { - latestReleaseVersion = 'v0.0.0' + latestReleaseVersion = "v0.0.0"; } else { - throw e + throw e; } } const listPullRequestsAssociatedWithCommitParams = { owner: context.repo.owner, repo: context.repo.repo, - commit_sha: process.env.SHA - } - console.log('call repos.listPullRequestsAssociatedWithCommit:', listPullRequestsAssociatedWithCommitParams) + commit_sha: process.env.SHA, + }; + console.log( + "call repos.listPullRequestsAssociatedWithCommit:", + listPullRequestsAssociatedWithCommitParams, + ); const pulls = await github.paginate( github.rest.repos.listPullRequestsAssociatedWithCommit, - listPullRequestsAssociatedWithCommitParams - ) - const labels = pulls.flatMap(p => p.labels.map(l => l.name)) - const tagNames = latestReleaseVersion.split('.') - let version + listPullRequestsAssociatedWithCommitParams, + ); + const labels = pulls.flatMap((p) => p.labels.map((l) => l.name)); + const tagNames = latestReleaseVersion.split("."); + let version; - if (labels.includes('major release')) { - version = [`v${Number(tagNames[0].replace('v', '')) + 1}`, 0, 0] - } else if (labels.includes('minor release')) { - version = [tagNames[0], Number(tagNames[1]) + 1, 0] + if (labels.includes("major release")) { + version = [`v${Number(tagNames[0].replace("v", "")) + 1}`, 0, 0]; + } else if (labels.includes("minor release")) { + version = [tagNames[0], Number(tagNames[1]) + 1, 0]; } else { - version = [tagNames[0], tagNames[1], Number(tagNames[2]) + 1] + version = [tagNames[0], tagNames[1], Number(tagNames[2]) + 1]; } - return version.join('.') -} + return version.join("."); +};