Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: align gh actions and dependabot with ecosystem standard, updat… #956

Merged
merged 1 commit into from
Feb 11, 2025
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
23 changes: 22 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,29 @@ updates:
directory: /
schedule:
interval: daily
time: '05:00'
time: '04:00'
commit-message:
prefix: fix
prefix-development: chore
include: scope
labels:
- dependabot
groups:
security-updates:
patterns:
- '*'
exclude-patterns:
- 'storyblok*'
update-types:
- patch
- minor
storyblok:
patterns:
- 'storyblok*'
update-types:
- patch
- minor
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-major
33 changes: 33 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on: [push, pull_request]

env:
PNPM_CACHE_FOLDER: .pnpm-store
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 # Skip installing simple-git-hooks

jobs:
commitlint:
# Skip job if PR is from Dependabot
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: pnpm commitlint --last --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: pnpm commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
28 changes: 28 additions & 0 deletions .github/workflows/dependabot-autoapprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'storyblok/storyblok-nuxt'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
alert-lookup: true
- uses: actions/checkout@v4
- name: Approve a PR if not already approved
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL"
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
28 changes: 0 additions & 28 deletions .github/workflows/dependabot-automerge.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:

jobs:
main:
# Skip job if PR is from Dependabot
if: github.actor != 'dependabot[bot]'
name: Validate PR title
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 # Skip installing simple-git-hooks

jobs:
lint:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 # Skip installing simple-git-hooks

permissions: {}

Expand All @@ -18,14 +18,15 @@ concurrency:

jobs:
build:
# Skip job if PR is from Dependabot
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4

- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@v4
with:
Expand Down
30 changes: 13 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,36 @@ name: Release CI

on:
push:
branches: [main, next]
branches: [main]
pull_request:
branches: [main, next]
branches: [main]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 # Skip installing simple-git-hooks

jobs:
release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 20
uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Set up Cypress binary cache
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-cypress-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install dependencies
run: pnpm install
- name: Build lib
run: pnpm run build
- name: Cypress run
run: pnpm run test:e2e
run: pnpm build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: pnpx semantic-release
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 # Skip installing simple-git-hooks

jobs:
test:
Expand Down Expand Up @@ -33,3 +33,11 @@ jobs:
run: pnpm run build
- name: Cypress run
run: pnpm run test:e2e
- name: Upload Cypress artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: cypress-artifacts
path: |
cypress/screenshots
cypress/videos
41 changes: 26 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@storyblok/nuxt",
"type": "module",
"version": "6.1.0",
"packageManager": "pnpm@9.9.0",
"version": "6.2.2",
"packageManager": "pnpm@10.2.0",
"description": "Storyblok Nuxt module",
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,31 +44,38 @@
"@storyblok/vue": "^8.1.10"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@cypress/vite-dev-server": "^5.2.0",
"@nuxt/eslint": "^0.6.1",
"@nuxt/eslint-config": "^0.5.7",
"@nuxt/kit": "^3.13.2",
"@commitlint/cli": "^19.7.1",
"@commitlint/config-conventional": "^19.7.1",
"@cypress/vite-dev-server": "^6.0.2",
"@nuxt/eslint": "^1.0.0",
"@nuxt/eslint-config": "^1.0.0",
"@nuxt/kit": "^3.15.4",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/schema": "^3.13.2",
"@nuxt/test-utils": "^3.14.3",
"@nuxt/schema": "^3.15.4",
"@nuxt/test-utils": "^3.15.4",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@storyblok/eslint-config": "^0.3.0",
"@types/node": "^20.8.10",
"@types/node": "^22.13.1",
"cypress": "^13.15.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^3.5.0",
"eslint-plugin-vue": "^9.28.0",
"nuxt": "^3.13.2",
"prettier": "^3.3.3",
"start-server-and-test": "^2.0.8"
"nuxt": "^3.15.4",
"prettier": "^3.4.2",
"simple-git-hooks": "^2.11.1",
"start-server-and-test": "^2.0.10"
},
"pnpm": {
"onlyBuiltDependencies": ["cypress"]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
],
"rules": {
"body-max-line-length": [2, "always", 200]
}
},
"release": {
"branches": [
Expand All @@ -81,5 +88,9 @@
},
"publishConfig": {
"access": "public"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint",
"pre-push": "pnpm commitlint --last --verbose"
}
}
Loading