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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# needed got pnpm test:ci
GITHUB_TOKEN='<...some token>'
GITHUB_REPOSITORY=s0/ghcommit
GITHUB_REPOSITORY=changesets/ghcommit

# Debug Logging
# RUNNER_DEBUG=1
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: |
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
npm install -g pnpm@$VERSION
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v 4.2.3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
VERSION=$(cat package.json | grep '"packageManager": "pnpm@' | sed 's/.*"pnpm@\([^"]*\)".*/\1/')
npm install -g pnpm@$VERSION
- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v 4.0.2
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v 4.2.3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# @changesets/ghcommit

## 1.3.0

### Minor Changes

- 1324104: Migrating package to @changesets namespace

Ownership of the repository has moved from https://github.com/s0/ghcommit
to https://github.com/changesets/ghcommit. As part of this we're also moving the
NPM package to the @changesets namespace. No functional changes have happened,
so this can be a drop-in replacement for `@s0/ghcommit`.

# @s0/ghcommit

## 1.2.1
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `@s0/ghcommit`
# `@changesets/ghcommit`

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

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

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

```
pnpm install @s0/ghcommit
pnpm install @changesets/ghcommit
```

### Usage in github actions
Expand Down Expand Up @@ -103,7 +103,7 @@ Example:

```ts
import { context, getOctokit } from "@actions/github";
import { commitChangesFromRepo } from "@s0/ghcommit/git";
import { commitChangesFromRepo } from "@changesets/ghcommit/git";

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

Expand Down Expand Up @@ -179,7 +179,7 @@ Example:

```ts
import { context, getOctokit } from "@actions/github";
import { commitFilesFromDirectory } from "@s0/ghcommit/fs";
import { commitFilesFromDirectory } from "@changesets/ghcommit/fs";

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

Expand Down Expand Up @@ -245,7 +245,7 @@ Example:

```ts
import { context, getOctokit } from "@actions/github";
import { commitFilesFromBuffers } from "@s0/ghcommit/node";
import { commitFilesFromBuffers } from "@changesets/ghcommit/node";

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

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

## Reporting a Vulnerability

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.
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.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@s0/ghcommit",
"version": "1.2.1",
"name": "@changesets/ghcommit",
"version": "1.3.0",
"private": false,
"description": "Directly change files on github using the github API, to support GPG signing",
"keywords": [
Expand All @@ -16,7 +16,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/s0/ghcommit.git"
"url": "https://github.com/changesets/ghcommit.git"
},
"exports": {
".": {
Expand Down
6 changes: 5 additions & 1 deletion src/test/integration/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { execFile } from "child_process";
import { getOctokit } from "@actions/github";
import { commitChangesFromRepo } from "../../git";
import { getRefTreeQuery } from "../../github/graphql/queries";
import { deleteBranches } from "./util";
import { deleteBranches, waitForGitHubToBeReady } from "./util";
import git from "isomorphic-git";

const octokit = getOctokit(ENV.GITHUB_TOKEN);
Expand Down Expand Up @@ -194,6 +194,8 @@ describe("git", () => {
log,
});

await waitForGitHubToBeReady();

await makeFileChangeAssertions(branch);

// Expect the OID to be the HEAD commit
Expand Down Expand Up @@ -263,6 +265,8 @@ describe("git", () => {
},
});

await waitForGitHubToBeReady();

await makeFileChangeAssertions(branch);

await expectParentHasOid({ branch, oid });
Expand Down
24 changes: 23 additions & 1 deletion src/test/integration/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getOctokit } from "@actions/github";

import { ENV, REPO, ROOT_TEST_BRANCH_PREFIX, log } from "./env.js";
import { commitFilesFromBuffers } from "../../node.js";
import { deleteBranches } from "./util.js";
import { deleteBranches, waitForGitHubToBeReady } from "./util.js";
import {
createRefMutation,
getRefTreeQuery,
Expand Down Expand Up @@ -169,6 +169,8 @@ describe("node", () => {
log,
});

await waitForGitHubToBeReady();

await expectBranchHasTree({
branch,
// TODO: re-enable
Expand Down Expand Up @@ -196,6 +198,8 @@ describe("node", () => {
...BASIC_FILE_CONTENTS,
});

await waitForGitHubToBeReady();

// Don't test tree for this one as it will change over time / be unstable
await expectBranchHasTree({
branch,
Expand All @@ -220,6 +224,8 @@ describe("node", () => {
...BASIC_FILE_CONTENTS,
});

await waitForGitHubToBeReady();

// Don't test tree for this one as it will change over time / be unstable
await expectBranchHasTree({
branch,
Expand All @@ -244,6 +250,8 @@ describe("node", () => {
...BASIC_FILE_CONTENTS,
});

await waitForGitHubToBeReady();

await expectBranchHasTree({
branch,
// TODO: re-enable
Expand Down Expand Up @@ -280,6 +288,8 @@ describe("node", () => {
force: true,
});

await waitForGitHubToBeReady();

await expectBranchHasTree({
branch,
// TODO: re-enable
Expand All @@ -304,6 +314,8 @@ describe("node", () => {
},
});

await waitForGitHubToBeReady();

expect(() =>
commitFilesFromBuffers({
octokit,
Expand Down Expand Up @@ -337,6 +349,8 @@ describe("node", () => {
},
});

await waitForGitHubToBeReady();

await commitFilesFromBuffers({
octokit,
...REPO,
Expand All @@ -347,6 +361,8 @@ describe("node", () => {
...BASIC_FILE_CONTENTS,
});

await waitForGitHubToBeReady();

await expectBranchHasTree({
branch,
// TODO: re-enable
Expand All @@ -371,6 +387,8 @@ describe("node", () => {
},
});

await waitForGitHubToBeReady();

await commitFilesFromBuffers({
octokit,
...REPO,
Expand All @@ -381,6 +399,8 @@ describe("node", () => {
...BASIC_FILE_CONTENTS,
});

await waitForGitHubToBeReady();

await expectBranchHasTree({
branch,
// TODO: re-enable
Expand Down Expand Up @@ -414,6 +434,8 @@ describe("node", () => {
message: input,
});

await waitForGitHubToBeReady();

const ref = (
await getRefTreeQuery(octokit, {
...REPO,
Expand Down
13 changes: 13 additions & 0 deletions src/test/integration/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,16 @@ export const deleteBranches = async (
console.debug(`Deleted branch ${branch}`);
}),
);

/**
* GitHub sometimes has a delay between making changes to a git repo,
* and those changes being reflected in the API.
*
* This function is a workaround to wait for GitHub to be ready
* before running these assertions.
*
* It slows down testing a bit,
* but it's better than having flaky tests.
*/
export const waitForGitHubToBeReady = () =>
new Promise((r) => setTimeout(r, 5000));