Skip to content

Adopt persistent Git object sessions and close them safely #745

Adopt persistent Git object sessions and close them safely

Adopt persistent Git object sessions and close them safely #745

Workflow file for this run

name: Release Preflight (PR)
on:
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: write
jobs:
preflight:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node 22
uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
- name: Install
run: npm ci
- name: Lint
run: npm run lint --if-present
- name: TypeScript
run: npm run typecheck:src
- name: TS policy
run: npm run typecheck:policy
- name: Build
run: npm run build --silent
- name: Test
run: npm run test:local --if-present
- name: npm pack dry-run
run: npm pack --dry-run
- name: JSR dry-run
run: npx -y jsr publish --dry-run
- name: Compute predicted dist-tag from package version
id: predict
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
DIST=latest
PRE=false
if [[ "$VERSION" =~ -(rc|beta|alpha)\. ]]; then
PRE=true
if [[ "$VERSION" =~ -rc\. ]]; then DIST=next; fi
if [[ "$VERSION" =~ -beta\. ]]; then DIST=beta; fi
if [[ "$VERSION" =~ -alpha\. ]]; then DIST=alpha; fi
fi
{
echo "version=$VERSION"
echo "dist=$DIST"
echo "pre=$PRE"
} >> "$GITHUB_OUTPUT"
- name: Release prep guard
run: npm run release:guard -- --stage prep-pr --tag "v${{ steps.predict.outputs.version }}"
- name: PR comment (release preview)
uses: actions/github-script@v8
env:
RELEASE_DIST: ${{ steps.predict.outputs.dist }}
RELEASE_PRE: ${{ steps.predict.outputs.pre }}
RELEASE_VERSION: ${{ steps.predict.outputs.version }}
with:
script: |
const requireEnv = (name) => {
const value = process.env[name];
if (!value) {
throw new Error(`${name} is required`);
}
return value;
};
const dist = requireEnv("RELEASE_DIST");
const pre = requireEnv("RELEASE_PRE");
const version = requireEnv("RELEASE_VERSION");
const body = [
"## Release Preflight",
"",
`- package version: \`${version}\``,
`- prerelease: \`${pre}\``,
`- npm dist-tag on release: \`${dist}\``,
"- npm pack dry-run: passed",
"- jsr publish dry-run: passed",
"",
`If this PR is from a \`release/*\` branch and merges to \`main\`, Main Push Release Branch Check will run final preflight and create \`v${version}\`. A maintainer who is a JSR \`@git-stunts\` scope member must then dispatch the Release workflow manually.`
].join("\n");
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body
});