Skip to content

Commit

Permalink
chore: add changesets & fix incorrect recursive command parameters (r…
Browse files Browse the repository at this point in the history
…ename pkgs)
  • Loading branch information
lin-stephanie committed Nov 20, 2024
1 parent e46597c commit 9048db6
Show file tree
Hide file tree
Showing 11 changed files with 865 additions and 2,506 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@svitejs/changesets-changelog-github-compact",
{
"repo": "lin-stephanie/astro-loaders"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint
run: pnpm lint

- name: Format
run: pnpm format

- name: Check
run: pnpm check

- name: Build packages
run: pnpm build
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
check_commit:
runs-on: ubuntu-latest
outputs:
release_found: ${{ steps.check_release.outputs.release_found }}
steps:
- name: Check for 'release' in latest commit message
id: check_release
run: |
LATEST_COMMIT="${{ github.event.head_commit.message }}"
echo "Latest commit message: $LATEST_COMMIT"
if echo "$LATEST_COMMIT" | grep -w "release" > /dev/null; then
echo "release_found=true" >> $GITHUB_OUTPUT
else
echo "release_found=false" >> $GITHUB_OUTPUT
fi
release_or_publish:
needs: check_commit
if: needs.check_commit.outputs.release_found == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build Packages
run: pnpm build

- name: Create release pr or publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm changeset version
publish: pnpm changeset publish
commit: "ci: release"
title: "ci: release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

skip_release:
needs: check_commit
if: needs.check_commit.outputs.release_found != 'true'
runs-on: ubuntu-latest
steps:
- name: No release trigger
run: echo "No 'release' found in latest commit message, skipping release workflow."

70 changes: 70 additions & 0 deletions .github/workflows/semantic-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Lint PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
types: |
fix
feat
chore
docs
ci
test
revert
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Thank you for your pull request! 🚀
The pull request titles need to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Required Format: `<type>(<scope>): <description>`
`<type>`: Indicates the kind of change you are making. Accepted types include:
- `fix`: Bug fixes.
- `feat`: New features.
- `chore`: Maintenance tasks.
- `docs`: Documentation updates.
- `ci`: CI related changes.
- `test`: Adding or updating tests.
- `revert`: Reverting changes.
`<scope>`: For this mono repo, required to specify which package is affected by this PR. Valid scopes are:
- `releases`: For `astro-loader-github-releases`.
- `prs`: For `astro-loader-github-prs`.
- `tweets`: For `astro-loader-tweets`.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
27 changes: 27 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Stale

on:
schedule:
- cron: '59 23 * * 0'

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v9
with:
days-before-stale: 30
days-before-close: 7
days-before-pr-close: -1
stale-issue-label: 'stale'
exempt-issue-labels: 'under review, on hold, todo, bug, good first issue, enhancement, help wanted, question'
stale-issue-message: 'This issue has been marked as stale due to inactivity and will be closed in 7 days unless there is further activity.'
close-issue-message: ''
stale-pr-label: 'stale'
exempt-pr-labels: 'awaiting reply, under review, on hold, todo, bug, good first issue, enhancement, help wanted, question'
stale-pr-message: 'This PR has been marked as stale due to inactivity.'
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@
"name": "root",
"private": true,
"version": "0.0.0",
"description": "Monorepo for managing Astro loader packages, including @ste7lin/astro-loaders-tweets, @ste7lin/astro-loaders-releases, and @ste7lin/astro-loaders-prs.",
"description": "Monorepo for managing Astro loader packages.",
"author": "Stephanie Lin <[email protected]>",
"license": "MIT",
"type": "module",
"repository": "github:lin-stephanie/astro-loaders",
"scripts": {
"preinstall": "npx only-allow pnpm",
"test": "pnpm test --filter @ste7lin/*",
"check": "pnpm check --filter @ste7lin/*",
"build": "pnpm build --filter @ste7lin/*",
"build": "pnpm --filter 'astro-loader*' build",
"build:docs": "astro build --root docs",
"check": "pnpm --filter 'astro-loader*' check",
"test": "pnpm --filter 'astro-loader*' test",
"format": "biome format",
"format:write": "biome format --write",
"format:imports": "biome check --formatter-enabled=false --linter-enabled=false --organize-imports-enabled=true --write",
"lint": "biome lint",
"lint:fix": "biome lint --write"
"lint:fix": "biome lint --write",
"change": "changeset add --open"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@biomejs/biome": "1.9.4",
"@changesets/cli": "^2.27.9",
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/typescript": "^4.1.1",
"@graphql-codegen/typescript-operations": "^4.3.1",
"@svitejs/changesets-changelog-github-compact": "^1.2.0",
"@types/node": "^22.9.0",
"@vitest/coverage-v8": "^2.1.5",
"astro": "^4.16.12",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-loader-github-prs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ste7lin/astro-loader-github-prs",
"name": "astro-loader-github-prs",
"private": false,
"version": "0.0.0",
"description": "",
Expand Down
10 changes: 7 additions & 3 deletions packages/astro-loader-github-releases/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ste7lin/astro-loader-github-releases",
"name": "astro-loader-github-releases",
"version": "0.0.0",
"description": "Aatro loader for loading GitHub release data from a given user or multiple repositories.",
"author": "Stephanie Lin <[email protected]>",
Expand All @@ -25,16 +25,20 @@
"types": "./dist/index.d.ts",
"scripts": {
"dev": "tsup src/index.ts --format esm --dts --watch",
"build": "tsup src/index.ts --format esm --dts --clean --minify --treeshake",
"build": "tsup src/index.ts --format esm --dts --clean --treeshake",
"check": "publint && attw $(pnpm pack) --ignore-rules=cjs-resolves-to-esm",
"test": "vitest && vitest run --coverage",
"generate": "graphql-codegen --config codegen.config.ts"
"generate": "graphql-codegen --config codegen.config.ts",
"prepublishOnly": "pnpm build"
},
"dependencies": {
"octokit": "^4.0.2"
},
"devDependencies": {},
"peerDependencies": {
"astro": "^4.14.0 || ^5.0.0-beta.0"
},
"publishConfig": {
"provenance": true
}
}
2 changes: 1 addition & 1 deletion packages/astro-loader-tweets/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@ste7lin/astro-loader-tweets",
"name": "astro-loader-tweets",
"private": false,
"version": "0.0.0",
"description": "",
Expand Down
Loading

0 comments on commit 9048db6

Please sign in to comment.