Skip to content

Commit b815d39

Browse files
authored
Update package name and repo url (#26)
* Update package name and repo url * Use latest version of @actions/cache * Update additional s0 references * Add delay between test steps to wait for GitHub GitHub's API for fetching repo contents seems to now have a bit of a delay before it works. * Run changeset version
1 parent 1054236 commit b815d39

File tree

10 files changed

+67
-15
lines changed

10 files changed

+67
-15
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# needed got pnpm test:ci
22
GITHUB_TOKEN='<...some token>'
3-
GITHUB_REPOSITORY=s0/ghcommit
3+
GITHUB_REPOSITORY=changesets/ghcommit
44

55
# Debug Logging
66
# RUNNER_DEBUG=1

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: |
2424
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
2525
npm install -g pnpm@$VERSION
26-
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
26+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v 4.2.3
2727
with:
2828
path: ~/.pnpm-store
2929
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

.github/workflows/release-and-publish.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
2929
npm install -g pnpm@$VERSION
3030
- name: Cache pnpm modules
31-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
31+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v 4.2.3
3232
with:
3333
path: ~/.pnpm-store
3434
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# @changesets/ghcommit
2+
3+
## 1.3.0
4+
5+
### Minor Changes
6+
7+
- 1324104: Migrating package to @changesets namespace
8+
9+
Ownership of the repository has moved from https://github.com/s0/ghcommit
10+
to https://github.com/changesets/ghcommit. As part of this we're also moving the
11+
NPM package to the @changesets namespace. No functional changes have happened,
12+
so this can be a drop-in replacement for `@s0/ghcommit`.
13+
114
# @s0/ghcommit
215

316
## 1.2.1

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# `@s0/ghcommit`
1+
# `@changesets/ghcommit`
22

3-
[![View on NPM](https://badgen.net/npm/v/@s0/ghcommit)](https://www.npmjs.com/package/@s0/ghcommit)
3+
[![View on NPM](https://badgen.net/npm/v/@changesets/ghcommit)](https://www.npmjs.com/package/@changesets/ghcommit)
44

55
NPM / TypeScript package to commit changes GitHub repositories using the GraphQL API.
66

@@ -32,7 +32,7 @@ NPM / TypeScript package to commit changes GitHub repositories using the GraphQL
3232
Install using your favourite package manager:
3333

3434
```
35-
pnpm install @s0/ghcommit
35+
pnpm install @changesets/ghcommit
3636
```
3737

3838
### Usage in github actions
@@ -103,7 +103,7 @@ Example:
103103

104104
```ts
105105
import { context, getOctokit } from "@actions/github";
106-
import { commitChangesFromRepo } from "@s0/ghcommit/git";
106+
import { commitChangesFromRepo } from "@changesets/ghcommit/git";
107107

108108
const octokit = getOctokit(process.env.GITHUB_TOKEN);
109109

@@ -179,7 +179,7 @@ Example:
179179

180180
```ts
181181
import { context, getOctokit } from "@actions/github";
182-
import { commitFilesFromDirectory } from "@s0/ghcommit/fs";
182+
import { commitFilesFromDirectory } from "@changesets/ghcommit/fs";
183183

184184
const octokit = getOctokit(process.env.GITHUB_TOKEN);
185185

@@ -245,7 +245,7 @@ Example:
245245

246246
```ts
247247
import { context, getOctokit } from "@actions/github";
248-
import { commitFilesFromBuffers } from "@s0/ghcommit/node";
248+
import { commitFilesFromBuffers } from "@changesets/ghcommit/node";
249249

250250
const octokit = getOctokit(process.env.GITHUB_TOKEN);
251251

SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
## Reporting a Vulnerability
1010

11-
Please select "Report a Vulnerability" on the [Security Tab](https://github.com/s0/ghcommit/security). We will investigate all legitimate reports and do our best to quickly fix the problem.
11+
Please select "Report a Vulnerability" on the [Security Tab](https://github.com/changesets/ghcommit/security). We will investigate all legitimate reports and do our best to quickly fix the problem.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@s0/ghcommit",
3-
"version": "1.2.1",
2+
"name": "@changesets/ghcommit",
3+
"version": "1.3.0",
44
"private": false,
55
"description": "Directly change files on github using the github API, to support GPG signing",
66
"keywords": [
@@ -16,7 +16,7 @@
1616
},
1717
"repository": {
1818
"type": "git",
19-
"url": "https://github.com/s0/ghcommit.git"
19+
"url": "https://github.com/changesets/ghcommit.git"
2020
},
2121
"exports": {
2222
".": {

src/test/integration/git.test.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { execFile } from "child_process";
1111
import { getOctokit } from "@actions/github";
1212
import { commitChangesFromRepo } from "../../git";
1313
import { getRefTreeQuery } from "../../github/graphql/queries";
14-
import { deleteBranches } from "./util";
14+
import { deleteBranches, waitForGitHubToBeReady } from "./util";
1515
import git from "isomorphic-git";
1616

1717
const octokit = getOctokit(ENV.GITHUB_TOKEN);
@@ -194,6 +194,8 @@ describe("git", () => {
194194
log,
195195
});
196196

197+
await waitForGitHubToBeReady();
198+
197199
await makeFileChangeAssertions(branch);
198200

199201
// Expect the OID to be the HEAD commit
@@ -263,6 +265,8 @@ describe("git", () => {
263265
},
264266
});
265267

268+
await waitForGitHubToBeReady();
269+
266270
await makeFileChangeAssertions(branch);
267271

268272
await expectParentHasOid({ branch, oid });

src/test/integration/node.test.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getOctokit } from "@actions/github";
33

44
import { ENV, REPO, ROOT_TEST_BRANCH_PREFIX, log } from "./env.js";
55
import { commitFilesFromBuffers } from "../../node.js";
6-
import { deleteBranches } from "./util.js";
6+
import { deleteBranches, waitForGitHubToBeReady } from "./util.js";
77
import {
88
createRefMutation,
99
getRefTreeQuery,
@@ -169,6 +169,8 @@ describe("node", () => {
169169
log,
170170
});
171171

172+
await waitForGitHubToBeReady();
173+
172174
await expectBranchHasTree({
173175
branch,
174176
// TODO: re-enable
@@ -196,6 +198,8 @@ describe("node", () => {
196198
...BASIC_FILE_CONTENTS,
197199
});
198200

201+
await waitForGitHubToBeReady();
202+
199203
// Don't test tree for this one as it will change over time / be unstable
200204
await expectBranchHasTree({
201205
branch,
@@ -220,6 +224,8 @@ describe("node", () => {
220224
...BASIC_FILE_CONTENTS,
221225
});
222226

227+
await waitForGitHubToBeReady();
228+
223229
// Don't test tree for this one as it will change over time / be unstable
224230
await expectBranchHasTree({
225231
branch,
@@ -244,6 +250,8 @@ describe("node", () => {
244250
...BASIC_FILE_CONTENTS,
245251
});
246252

253+
await waitForGitHubToBeReady();
254+
247255
await expectBranchHasTree({
248256
branch,
249257
// TODO: re-enable
@@ -280,6 +288,8 @@ describe("node", () => {
280288
force: true,
281289
});
282290

291+
await waitForGitHubToBeReady();
292+
283293
await expectBranchHasTree({
284294
branch,
285295
// TODO: re-enable
@@ -304,6 +314,8 @@ describe("node", () => {
304314
},
305315
});
306316

317+
await waitForGitHubToBeReady();
318+
307319
expect(() =>
308320
commitFilesFromBuffers({
309321
octokit,
@@ -337,6 +349,8 @@ describe("node", () => {
337349
},
338350
});
339351

352+
await waitForGitHubToBeReady();
353+
340354
await commitFilesFromBuffers({
341355
octokit,
342356
...REPO,
@@ -347,6 +361,8 @@ describe("node", () => {
347361
...BASIC_FILE_CONTENTS,
348362
});
349363

364+
await waitForGitHubToBeReady();
365+
350366
await expectBranchHasTree({
351367
branch,
352368
// TODO: re-enable
@@ -371,6 +387,8 @@ describe("node", () => {
371387
},
372388
});
373389

390+
await waitForGitHubToBeReady();
391+
374392
await commitFilesFromBuffers({
375393
octokit,
376394
...REPO,
@@ -381,6 +399,8 @@ describe("node", () => {
381399
...BASIC_FILE_CONTENTS,
382400
});
383401

402+
await waitForGitHubToBeReady();
403+
384404
await expectBranchHasTree({
385405
branch,
386406
// TODO: re-enable
@@ -414,6 +434,8 @@ describe("node", () => {
414434
message: input,
415435
});
416436

437+
await waitForGitHubToBeReady();
438+
417439
const ref = (
418440
await getRefTreeQuery(octokit, {
419441
...REPO,

src/test/integration/util.ts

+13
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ export const deleteBranches = async (
3535
console.debug(`Deleted branch ${branch}`);
3636
}),
3737
);
38+
39+
/**
40+
* GitHub sometimes has a delay between making changes to a git repo,
41+
* and those changes being reflected in the API.
42+
*
43+
* This function is a workaround to wait for GitHub to be ready
44+
* before running these assertions.
45+
*
46+
* It slows down testing a bit,
47+
* but it's better than having flaky tests.
48+
*/
49+
export const waitForGitHubToBeReady = () =>
50+
new Promise((r) => setTimeout(r, 5000));

0 commit comments

Comments
 (0)