Skip to content

Commit

Permalink
chore: align gh actions and dependabot with ecosystem standard
Browse files Browse the repository at this point in the history
  • Loading branch information
edodusi committed Jan 14, 2025
1 parent 2371fa6 commit 3a89115
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 31 deletions.
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/issue.bug.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: 🐞 SDK Bug Report
description: Report an issue using Svelte Storyblok SDK
description: Report an issue using React Storyblok SDK
labels: [pending-triage, pending-author]
body:
- type: markdown
attributes:
value: |
You're now going to fill out a bug report at the Svelte Storyblok SDK. Thanks a lot for taking the time and let's make Storyblok open source projects better together!
You're now going to fill out a bug report at the React Storyblok SDK. Thanks a lot for taking the time and let's make Storyblok open source projects better together!
- type: textarea
id: bug-description
attributes:
label: Describe the issue you're facing
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description so we can review it. Thanks in advance!
placeholder: My Svelte Storyblok SDK configuration is ... # # Expected behavior ... ## Current Behavior ...
placeholder: My React Storyblok SDK configuration is ... # # Expected behavior ... ## Current Behavior ...
validations:
required: true
- type: input
Expand All @@ -32,9 +32,9 @@ body:
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages '{ svelte, @storyblok/*}' --binaries --browsers`
description: Output of `npx envinfo --system --npmPackages '{ react, @storyblok/*}' --binaries --browsers`
render: shell
placeholder: System, Binaries, Browsers, Svelte & Storyblok SDK version
placeholder: System, Binaries, Browsers, React & Storyblok SDK version
validations:
required: true
- type: dropdown
Expand All @@ -60,7 +60,7 @@ body:
label: Validations
description: Before submitting the issue, please make sure you do the following
options:
- label: Follow our [Code of Conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client)
- label: Follow our [Code of Conduct](https://www.storyblok.com/trust-center?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js-client#code-of-conduct)
required: true
- type: markdown
attributes:
Expand Down
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,15 @@ updates:
prefix: fix
prefix-development: chore
include: scope
labels:
- dependabot
groups:
security-updates:
applies-to: security-updates
update-types:
- patch
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-minor
- version-update:semver-major
31 changes: 31 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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:
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
26 changes: 13 additions & 13 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# **** AUTOMERGE ****
# Merge automatically the PR that contain a minor or patch update on the dependency you define in env.DEPENDENCY
# - Inspiration: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request

name: Dependabot auto-merge
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'storyblok/storyblok-react'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.1.1
uses: dependabot/fetch-metadata@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
if: ${{contains(steps.metadata.outputs.dependency-names, env.DEPENDENCY) && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')}}
run: gh pr merge --auto --merge "$PR_URL"
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:
DEPENDENCY: '@storyblok/js'
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.DEPENDABOT_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run linters
on: [push]

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

jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: Run Lint
run: pnpm run lint
38 changes: 38 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Any Commit
on:
push:
branches:
- '**'
tags:
- '!**'

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

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- run: pnpx pkg-pr-new publish --compact --pnpm
30 changes: 18 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,36 @@ name: Release CI

on:
push:
branches: [main, v2-maintenance]
branches: [main]
pull_request:
branches: [main, v2-maintenance]
branches: [main]

env:
PNPM_CACHE_FOLDER: .pnpm-store
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@v4
- name: Setup Node
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: npm ci
run: pnpm install
- name: Build lib
run: npm run build
- name: Jest run
run: npm run test:unit
run: pnpm build
- name: Release
working-directory: lib
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: pnpx semantic-release
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run tests

on: [push]

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

jobs:
tests:
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4

- 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: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install dependencies
run: pnpm install

- name: Build Library
run: pnpm build

- name: Vitest run
run: pnpm run test:unit:ci --silent

- 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

0 comments on commit 3a89115

Please sign in to comment.