Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Cosmetic changes + readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam committed Jun 20, 2024
1 parent e97a396 commit 2166363
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>
# 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: /
Expand Down
13 changes: 13 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -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: ['*']
11 changes: 7 additions & 4 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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: {}
Expand All @@ -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 }}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
Expand All @@ -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 '[email protected]'
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: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Metadata syntax: <https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions>
# 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
Expand Down

0 comments on commit 2166363

Please sign in to comment.