Skip to content

promote to stable #254

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

Draft
wants to merge 54 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
5bed41c
fix(deps): upgrade to the alpha version of the repository-settings pl…
travi Mar 31, 2025
4f316b0
chore(deps): lock file maintenance
renovate[bot] Mar 31, 2025
9784004
chore(deps): update dependency vitest to v3.1.1
renovate[bot] Mar 31, 2025
91475ff
Merge pull request #245 from form8ion/renovate/alpha-vitest-monorepo
renovate[bot] Mar 31, 2025
2ce3e77
Merge branch 'master' of github.com:form8ion/github into alpha
travi Apr 2, 2025
aa00eff
Merge branch 'alpha' of github.com:form8ion/github into alpha
travi Apr 2, 2025
72f3e41
chore(deps): update dependency rollup to v4.39.0
renovate[bot] Apr 2, 2025
2cfee1e
Merge pull request #249 from form8ion/renovate/alpha-rollup-4.x
renovate[bot] Apr 2, 2025
411b230
feat(octokit): expect instance to be passed as a dependency
travi Apr 3, 2025
2daa452
chore(deps): update dependency publint to v0.3.10
renovate[bot] Apr 3, 2025
c2153b4
Merge pull request #251 from form8ion/renovate/alpha-publint-0.x
renovate[bot] Apr 3, 2025
8903768
docs(octokit): updated to align with the need to provide an instance
travi Apr 4, 2025
ab4bc4f
fix(deps): upgrade to the stable version of github-core
travi Apr 6, 2025
11fa005
Merge branch 'master' of github.com:form8ion/github into alpha
travi Apr 6, 2025
c34bcd8
Merge pull request #253 from form8ion/alpha
travi Apr 6, 2025
608a627
feat(logger): expect logger to be passed rather than depending direct…
travi Apr 7, 2025
ae42cd2
refactor: add names to default exports
travi Apr 7, 2025
6cd6e5e
feat(lift): log that lifting is occurring
travi Apr 7, 2025
fabeb63
chore(deps): lock file maintenance
renovate[bot] Apr 7, 2025
581ff3b
chore(deps): update npm to v11.3.0
renovate[bot] Apr 8, 2025
f4eb6b1
Merge pull request #257 from form8ion/renovate/beta-npm-11.x
renovate[bot] Apr 9, 2025
ef3327a
chore(deps): update dependency publint to v0.3.11
renovate[bot] Apr 10, 2025
cd023ae
Merge pull request #259 from form8ion/renovate/beta-publint-0.x
renovate[bot] Apr 10, 2025
34ed6f8
Merge branch 'master' of github.com:form8ion/github into beta
travi Apr 10, 2025
1804cf4
Reapply "feat(predicate): leverage implementation from the core package"
travi Apr 10, 2025
e2e5398
fix(deps): upgrade to the latest alpha of the repository-settings plugin
travi Apr 10, 2025
294de45
ci(gravity): configure gravity to track bundle size changes
travi Apr 11, 2025
2ece73c
chore(deps): update dependency msw to v2.7.4
renovate[bot] Apr 12, 2025
aa7defa
Merge pull request #262 from form8ion/renovate/beta-msw-2.x
renovate[bot] Apr 12, 2025
fd4dc85
chore(deps): update dependency rollup to v4.40.0
renovate[bot] Apr 12, 2025
3d37ee4
Merge pull request #264 from form8ion/renovate/beta-rollup-4.x
renovate[bot] Apr 12, 2025
b5da7bd
chore(action): update actions/setup-node action to v4.4.0
renovate[bot] Apr 14, 2025
53903df
Merge pull request #266 from form8ion/renovate/beta-actions-setup-nod…
renovate[bot] Apr 14, 2025
c454717
chore(deps): update dependency publint to v0.3.12
renovate[bot] Apr 14, 2025
04a8c0a
Merge pull request #268 from form8ion/renovate/beta-publint-0.x
renovate[bot] Apr 14, 2025
6474e20
chore(action): update codecov/codecov-action action to v5.4.2
renovate[bot] Apr 14, 2025
6cb7b27
Merge pull request #270 from form8ion/renovate/beta-codecov-codecov-a…
renovate[bot] Apr 15, 2025
049fcd4
feat(lift): pass vcs details to the repo-settings lifter
travi Apr 18, 2025
d927dca
feat(node-versions): raise the minimum within supported ranges
travi Apr 18, 2025
4971c7f
fix(deps): upgrade to the latest alpha of the repo-settings plugin
travi Apr 18, 2025
47eee90
chore(deps): update dependency msw to v2.7.5
renovate[bot] Apr 18, 2025
f50a4e3
Merge pull request #272 from form8ion/renovate/beta-msw-2.x
renovate[bot] Apr 19, 2025
ac95548
fix(deps): upgrade to the beta of the repository-settings plugin
travi Apr 19, 2025
3290aed
chore(deps): lock file maintenance
renovate[bot] Apr 21, 2025
a095a75
chore(deps): update dependency vitest to v3.1.2
renovate[bot] Apr 21, 2025
1ae4a98
Merge pull request #274 from form8ion/renovate/beta-vitest-monorepo
renovate[bot] Apr 21, 2025
7916663
chore(deps): update dependency lockfile-lint to v4.14.1
renovate[bot] Apr 27, 2025
c25b6b5
Merge pull request #276 from form8ion/renovate/beta-lockfile-lint-4.x
renovate[bot] Apr 27, 2025
9f035f8
feat(settings): prompt about whether the repo settings should be mana…
travi Apr 28, 2025
8a43e12
refactor(repo-owner): extract the prompt for repository details, like…
travi Apr 28, 2025
ff32c4a
refactor(owner): encapsulate the owner prompt into the repo scaffolder
travi Apr 28, 2025
2e81f2a
chore(deps): update dependency rollup to v4.40.1
renovate[bot] Apr 28, 2025
c9ad36c
Merge pull request #278 from form8ion/renovate/beta-rollup-4.x
renovate[bot] Apr 28, 2025
ec5f1cd
chore(deps): lock file maintenance
renovate[bot] Apr 28, 2025
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
14 changes: 8 additions & 6 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ jobs:
strategy:
matrix:
node:
- 18.17.0
- 20.6.1
- 22
- 20.19.0
- 22.14.0
- 23
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup node
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
cache: npm
node-version: ${{ matrix.node }}
Expand All @@ -38,15 +37,18 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup node
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: .nvmrc
cache: npm
- run: npm clean-install
- run: npm install --global corepack@latest
- run: corepack npm audit signatures
- run: npm test
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
- run: npx @gravityci/cli ./lib/
env:
GRAVITY_TOKEN: ${{ secrets.GRAVITY_TOKEN }}
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
release:
needs:
- verify
Expand Down
68 changes: 49 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ $ npm install @form8ion/github --save-prod

### Enabling actions against the GitHub API

This plugin leverages the [.netrc strategy](https://github.com/travi/octokit-auth-netrc)
for [octokit](https://github.com/octokit/rest.js/). Be sure to
[add your personal access token](https://github.com/travi/octokit-auth-netrc#defining-your-token)
to leverage the GitHub API integration benefits of this plugin.
Provide an authenticated octokit instance as the `octokit` property in the
options

### Enabling repository configuration with `repository-settings/app`

Expand All @@ -92,13 +90,21 @@ The settings file generated by this tool assumes that it is extending an

```javascript
import any from '@travi/any';
import {octokit} from '@form8ion/github-core';
import {lift, promptConstants, scaffold, test} from '@form8ion/github';
```

#### Execute

```javascript
const projectRoot = process.cwd();
const octokitInstance = octokit.getNetrcAuthenticatedInstance();
const logger = {
info: message => console.error(message),
success: message => console.error(message),
warn: message => console.error(message),
error: message => console.error(message)
};

await scaffold(
{
Expand All @@ -110,27 +116,51 @@ await scaffold(
{
prompt: async ({id}) => {
const {questionNames, ids} = promptConstants;
const expectedPromptId = ids.GITHUB_DETAILS;

if (expectedPromptId === id) {
return {[questionNames[expectedPromptId].GITHUB_ACCOUNT]: any.word()};
const {
GITHUB_DETAILS: githubDetailsPromptId,
ADMIN_SETTINGS: repositorySettingsPromptId
} = ids;

switch (id) {
case githubDetailsPromptId:
return {[questionNames[githubDetailsPromptId].GITHUB_ACCOUNT]: any.word()};
case repositorySettingsPromptId:
return {[questionNames[repositorySettingsPromptId].SETTINGS_MANAGED_AS_CODE]: any.boolean()};
default:
throw new Error(`Unknown prompt with ID: ${id}`);
}

throw new Error(`Unknown prompt with ID: ${id}`);
}
},
octokit: octokitInstance,
logger
}
);

if (await test({projectRoot})) {
await lift({
projectRoot,
vcs: {owner: 'account-name', name: 'repository-name'},
results: {
projectDetails: {homepage: any.url()},
tags: any.listOf(any.word),
nextSteps: any.listOf(() => ({summary: any.sentence(), description: any.sentence()}))
await lift(
{
projectRoot,
vcs: {owner: 'account-name', name: 'repository-name'},
results: {
projectDetails: {homepage: any.url()},
tags: any.listOf(any.word),
nextSteps: any.listOf(() => ({summary: any.sentence(), description: any.sentence()}))
}
},
{
octokit: octokitInstance,
logger,
prompt: async ({id}) => {
const {questionNames, ids} = promptConstants;
const expectedPromptId = ids.REQUIRED_CHECK_BYPASS;

if (expectedPromptId === id) {
return {[questionNames[expectedPromptId].CHECK_BYPASS_TEAM]: any.integer()};
}

throw new Error(`Unknown prompt with ID: ${id}`);
}
}
});
);
}
```

Expand Down
67 changes: 52 additions & 15 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// #### Import
// remark-usage-ignore-next 2
import {resolve} from 'path';
import {resolve} from 'node:path';
import stubbedFs from 'mock-fs';
import any from '@travi/any';
import {octokit} from '@form8ion/github-core';
import {lift, promptConstants, scaffold, test} from './lib/index.js';

// remark-usage-ignore-next
stubbedFs({node_modules: stubbedFs.load(resolve('node_modules'))});

// #### Execute

// remark-usage-ignore-next
/* eslint-disable no-console */
const projectRoot = process.cwd();
const octokitInstance = octokit.getNetrcAuthenticatedInstance();
const logger = {
info: message => console.error(message),
success: message => console.error(message),
warn: message => console.error(message),
error: message => console.error(message)
};

await scaffold(
{
Expand All @@ -22,25 +32,52 @@ await scaffold(
{
prompt: async ({id}) => {
const {questionNames, ids} = promptConstants;
const expectedPromptId = ids.GITHUB_DETAILS;
const {
GITHUB_DETAILS: githubDetailsPromptId,
ADMIN_SETTINGS: repositorySettingsPromptId
} = ids;

if (expectedPromptId === id) {
return {[questionNames[expectedPromptId].GITHUB_ACCOUNT]: any.word()};
switch (id) {
case githubDetailsPromptId:
return {[questionNames[githubDetailsPromptId].GITHUB_ACCOUNT]: any.word()};
case repositorySettingsPromptId:
return {[questionNames[repositorySettingsPromptId].SETTINGS_MANAGED_AS_CODE]: any.boolean()};
default:
throw new Error(`Unknown prompt with ID: ${id}`);
}

throw new Error(`Unknown prompt with ID: ${id}`);
}
},
octokit: octokitInstance,
logger
}
);

if (await test({projectRoot})) {
await lift({
projectRoot,
vcs: {owner: 'account-name', name: 'repository-name'},
results: {
projectDetails: {homepage: any.url()},
tags: any.listOf(any.word),
nextSteps: any.listOf(() => ({summary: any.sentence(), description: any.sentence()}))
await lift(
{
projectRoot,
vcs: {owner: 'account-name', name: 'repository-name'},
results: {
projectDetails: {homepage: any.url()},
tags: any.listOf(any.word),
nextSteps: any.listOf(() => ({summary: any.sentence(), description: any.sentence()}))
}
},
{
octokit: octokitInstance,
logger,
prompt: async ({id}) => {
const {questionNames, ids} = promptConstants;
const expectedPromptId = ids.REQUIRED_CHECK_BYPASS;

if (expectedPromptId === id) {
return {[questionNames[expectedPromptId].CHECK_BYPASS_TEAM]: any.integer()};
}

throw new Error(`Unknown prompt with ID: ${id}`);
}
}
});
);
}

// remark-usage-ignore-next
/* eslint-enable no-console */
Loading