diff --git a/.editorconfig b/.editorconfig index 3a801df..207d9c7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,7 @@ insert_final_newline = true indent_style = space indent_size = 2 trim_trailing_whitespace = true + +[{*.yml,*.yaml}] +ij_any_spaces_within_braces = false +ij_any_spaces_within_brackets = false diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5309064..9989651 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,9 @@ -# Docs: +# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json +# docs: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates version: 2 + updates: - package-ecosystem: github-actions directory: / diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..2a0b405 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-release-config.json +# docs: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + categories: + - title: ๐Ÿ›  Fixes + labels: [type:fix, type:bug] + - title: ๐Ÿš€ Features + labels: [type:feature, type:feature_request] + - title: ๐Ÿ“ฆ Dependency updates + labels: [dependencies] + - title: Other Changes + labels: ['*'] diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 0a10d13..53955f6 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -1,4 +1,7 @@ -name: dependabot +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions + +name: ๐Ÿค– Dependabot on: pull_request: {} @@ -9,15 +12,15 @@ permissions: jobs: dependabot: # https://tinyurl.com/e69djmen + name: Enable auto-merge for Dependabot PRs runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - - uses: dependabot/fetch-metadata@v1 + - uses: dependabot/fetch-metadata@v2 id: metadata with: {github-token: "${{ secrets.GITHUB_TOKEN }}"} - - name: Enable auto-merge for Dependabot PRs - if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }} + - if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70e54cf..3be54ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,7 @@ -name: release +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions + +name: ๐Ÿš€ Release on: release: # Docs: @@ -10,22 +13,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - {uses: gacts/github-slug@v1, id: slug} - - - name: Setup git - env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"} + - env: {REPO_PATH: "${{ github.repository_owner }}/${{ github.event.repository.name }}"} run: | git config --local user.email 'actions@github.com' git config --local user.name "${{ github.actor }}" git remote set-url origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/$REPO_PATH.git" - - name: Update major tag env: {VERSION: "${{ steps.slug.outputs.version-major }}"} run: | git tag -fa "v$VERSION" -m "Update v$VERSION tag (using GitHub actions)" git push --set-upstream origin "v$VERSION" --force - - name: Update minor tag env: {VERSION: "${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}"} run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9bb16e5..0c5b4bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,7 @@ -name: tests +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions + +name: ๐Ÿงช Tests on: push: @@ -8,14 +11,14 @@ on: pull_request: paths-ignore: ['**.md'] +env: {FORCE_COLOR: 'true'} + jobs: gitleaks: - name: GitLeaks + name: Check for GitLeaks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: {fetch-depth: 0} - + - {uses: actions/checkout@v4, with: {fetch-depth: 0}} - uses: gacts/gitleaks@v1 run-this-action: diff --git a/README.md b/README.md index 1ab6f53..20abf9c 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,25 @@ [![Build Status][badge_build]][link_build] [![License][badge_license]][link_license] -Composite GitHub Action which combines the perfect pairing of [actions/setup-node](https://github.com/actions/setup-node) with [actions/cache](https://github.com/actions/cache) for the caching. +> [!IMPORTANT] +> Seems like this action is no longer makes sense, because the [actions/setup-node](https://github.com/actions/setup-node) +> now supports caching out of the box. Please, use it instead like this way: +> +> ```yaml +> steps: +> - uses: actions/setup-node@v4 +> with: {node-version: 20, cache: 'npm'} +> ``` + +Composite GitHub Action which combines the perfect pairing of [actions/setup-node](https://github.com/actions/setup-node) +with [actions/cache](https://github.com/actions/cache) for the caching. Reducing all these workflow steps: ```yaml steps: - name: Setup NodeJS - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 19 @@ -24,7 +35,7 @@ steps: shell: bash run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' with: path: ${{ steps.npm-cache-dir.outputs.dir }} @@ -36,7 +47,7 @@ steps: shell: bash run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 + - uses: actions/cache@v4 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir.outputs.dir }} @@ -48,16 +59,14 @@ Down to this: ```yaml steps: - - uses: gacts/setup-node-with-cache@v1 - with: {node-version: 19} + - {uses: gacts/setup-node-with-cache@v1, with: {node-version: 19}} ``` Or using `node-version-file` for version selection: ```yaml steps: - - uses: gacts/setup-node-with-cache@v1 - with: {node-version-file: .node-version} + - {uses: gacts/setup-node-with-cache@v1, with: {node-version-file: .node-version}} ``` Output values can be used on your choice, for example: @@ -72,7 +81,8 @@ steps: run: npm ci ``` -> Tip: Use [Dependabot][use_dependabot] to maintain your `gacts/setup-node-with-cache` version updated in your GitHub workflows. +> [!TIP] +> Use [Dependabot](https://bit.ly/45zwLL1) to keep this action updated in your repository. ## Support @@ -96,5 +106,3 @@ This is open-sourced software licensed under the [MIT License][link_license]. [link_issues]:https://github.com/gacts/setup-node-with-cache/issues [link_create_issue]:https://github.com/gacts/setup-node-with-cache/issues/new [link_pulls]:https://github.com/gacts/setup-node-with-cache/pulls - -[use_dependabot]:https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot diff --git a/action.yml b/action.yml index 4198205..8e37645 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,5 @@ -# Metadata syntax: +# yaml-language-server: $schema=https://json.schemastore.org/github-action.json +# docs: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions name: Setup NodeJS environment with a Cache description: Setup a Node environment, additionally enable caching