Skip to content
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
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "Doctocat Dev Container",
"image": "mcr.microsoft.com/devcontainers/javascript-node:24",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8000, 9000],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",

// Configure the container to run as a non-root user with the same UID/GID as your local user.
"remoteUser": "node"
}
71 changes: 62 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
name: Release
on:
push:
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow now triggers on every push to any branch without filtering. This will cause both jobs to evaluate their conditions on every push, which is inefficient. The original workflows had proper branch filtering (main/next_major for release, branches-ignore for canary). Consider adding back branch filtering in the trigger, or accept that both jobs will be evaluated on every push (though only one will run due to the if conditions).

Suggested change
push:
push:
branches:
- main
- '**'
branches-ignore:
- changeset-release/main

Copilot uses AI. Check for mistakes.
branches:
- 'main'
- 'next_major'

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

permissions:
id-token: write # Required for OIDC
contents: read
checks: write
statuses: write

jobs:
release:
name: Final
if: ${{ github.repository == 'primer/doctocat' }}
release-main:
name: Main
if: ${{ github.repository == 'primer/doctocat' && github.ref_name == 'main' }}

runs-on: ubuntu-latest
steps:
Expand All @@ -21,19 +29,64 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 18
node-version: 24
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Create release pull request or publish to npm
id: changesets
uses: changesets/action@master
uses: changesets/action@v1
with:
title: Release Tracking
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}

release-canary:
name: Canary
if: ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canary job condition excludes 'changeset-release/main' but the original workflow excluded all 'changeset-release/**' branches (using branches-ignore pattern). This may allow canary releases from other changeset-release branches like 'changeset-release/next_major'. Consider using 'startsWith(github.ref_name, "changeset-release/")' to match the original behavior.

Suggested change
if: ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
if: ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && !startsWith(github.ref_name, 'changeset-release/') }}

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canary job condition also needs to exclude 'dependabot/**' branches, which were excluded in the original release_canary.yml workflow (line 7 in the old file). Without this exclusion, the workflow will attempt to create canary releases for dependabot branches.

Suggested change
if: ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
if: ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' && !startsWith(github.ref_name, 'dependabot/') }}

Copilot uses AI. Check for mistakes.

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Publish canary version
run: |
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
echo -e "---\n'@primer/gatsby-theme-doctocat': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
rm -f .changeset/pre.json
npx changeset version --snapshot
npx changeset publish --tag canary
Comment on lines +69 to +75
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canary release job is missing NPM authentication setup. The original release_canary.yml workflow (lines 31-37) created an .npmrc file with NPM_TOKEN for authentication. Without this, the 'changeset publish' command on line 65 will fail when attempting to publish to npm.

Copilot uses AI. Check for mistakes.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output canary version number
uses: actions/github-script@v8
with:
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/theme/package.json`)
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: 'success',
context: `Published ${package.name}`,
description: package.version,
target_url: `https://unpkg.com/${package.name}@${package.version}/`
})
62 changes: 0 additions & 62 deletions .github/workflows/release_canary.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v24
Loading