Skip to content

Commit

Permalink
Merge pull request #1 from philrenaud/clubhouse-updated-to-shortcut
Browse files Browse the repository at this point in the history
Clubhouse updated to shortcut
  • Loading branch information
philrenaud authored Sep 17, 2021
2 parents a379af6 + 3fd8e7c commit c470992
Show file tree
Hide file tree
Showing 5 changed files with 9,360 additions and 13,641 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ _before_ the pull request is created.

This Action will specifically check for branch names that follow the naming
convention for this built-in integration. Any branch name that contains
`ch####` will be ignored by this Action, on the assumption that a Clubhouse
story already exists for the pull request. The `ch####` must be separated
`sc-####` will be ignored by this Action, on the assumption that a Clubhouse
story already exists for the pull request. The `sc-####` must be separated
from leading or following text with either a `/` or a `-`. So, branches
named `ch1`, `prefix/ch23`, `prefix-ch123`, `ch3456/suffix`, `ch3456-suffux`,
`prefix/ch987/suffix` would match, but `xch123` and `ch987end` would not.
named `sc-1`, `prefix/sc-23`, `prefix-sc-123`, `sc-3456/suffix`, `sc-3456-suffux`,
`prefix/sc-987/suffix` would match, but `xsc-123` and `sc-987end` would not.

## Customizing the Pull Request Comment

Expand Down Expand Up @@ -180,7 +180,7 @@ Multiple users should be separated by commas.
## Iteration Support

Clubhouse supports the concept of [iterations](https://help.clubhouse.io/hc/en-us/articles/360028953452-Iterations-Overview)
-- time-boxed periods of development for stories. You can configure this Action
-- time-boxed periods of development for stories. You can configure this Action
to automatically assign the Clubhouse stories it creates to Clubhouse iterations,
using GitHub labels and Clubhouse groups to identify the correct iteration to use.

Expand All @@ -189,7 +189,7 @@ the way you use Clubhouse and GitHub:

- We assume that each team has an associated [Clubhouse group](https://help.clubhouse.io/hc/en-us/articles/360039328751-Groups-Group-Management),
and that Clubhouse iterations are associated with this group.
- We assume that the correct iteration to use is the *most recent*
- We assume that the correct iteration to use is the _most recent_
in-progress iteration for the group, as determined by the "last updated" time.
(However, you may exclude specific iterations by name.)
- We assume that each team has an associated [GitHub label](https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/managing-labels),
Expand All @@ -198,7 +198,7 @@ the way you use Clubhouse and GitHub:
[Labeler Action](https://github.com/actions/labeler).)

If you want to use this feature, and you have a different workflow that
does *not* match these assumptions, open a GitHub Issue on this repo
does _not_ match these assumptions, open a GitHub Issue on this repo
and let's talk about it! Maybe we can find a way to make this Action
support other workflows, as well.

Expand Down
28 changes: 14 additions & 14 deletions __tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,21 @@ describe("createClubhouseStory", () => {
});

test.each([
["ch1", "1"],
["ch89/something", "89"],
["ch99-something", "99"],
["prefix-1/ch123", "123"],
["prefix-1-ch321", "321"],
["prefix/ch5678/suffix", "5678"],
["prefix-ch6789/suffix-more", "6789"],
["prefix/ch7890-suffix", "7890"],
["prefix-ch0987-suffix-extra", "0987"],
["sc-1", "1"],
["sc-89/something", "89"],
["sc-99-something", "99"],
["prefix-1/sc-123", "123"],
["prefix-1-sc-321", "321"],
["prefix/sc-5678/suffix", "5678"],
["prefix-sc-6789/suffix-more", "6789"],
["prefix/sc-7890-suffix", "7890"],
["prefix-sc-0987-suffix-extra", "0987"],
])("getClubhouseStoryIdFromBranchName matches %s", (branch, expected) => {
const id = util.getClubhouseStoryIdFromBranchName(branch);
expect(id).toEqual(expected);
});

test.each(["prefix/ch8765+suffix", "ch554X", "ach8765", "this_ch1234"])(
test.each(["prefix/sc-8765+suffix", "sc-554X", "asc-8765", "this_sc-1234"])(
"getClubhouseStoryIdFromBranchName does not match %s",
(branch) => {
const id = util.getClubhouseStoryIdFromBranchName(branch);
Expand Down Expand Up @@ -248,7 +248,7 @@ test("getClubhouseURLFromPullRequest", async () => {
test("getClubhouseURLFromPullRequest desc", async () => {
const payload = {
pull_request: {
body: "Clubhouse story: https://app.clubhouse.io/org/story/12345",
body: "Clubhouse story: https://app.shortcut.com/org/story/12345",
number: 123,
},
repository: {
Expand All @@ -260,7 +260,7 @@ test("getClubhouseURLFromPullRequest desc", async () => {
};

const url = await util.getClubhouseURLFromPullRequest(payload as any);
expect(url).toEqual("https://app.clubhouse.io/org/story/12345");
expect(url).toEqual("https://app.shortcut.com/org/story/12345");
});

test("getClubhouseURLFromPullRequest comment", async () => {
Expand All @@ -281,11 +281,11 @@ test("getClubhouseURLFromPullRequest comment", async () => {
.get("/repos/octocat/example/issues/123/comments")
.reply(200, [
{ body: "no url here, either!" },
{ body: "Clubhouse story: https://app.clubhouse.io/org/story/12345" },
{ body: "Clubhouse story: https://app.shortcut.com/org/story/12345" },
]);

const url = await util.getClubhouseURLFromPullRequest(payload as any);
expect(url).toEqual("https://app.clubhouse.io/org/story/12345");
expect(url).toEqual("https://app.shortcut.com/org/story/12345");

scope.done();
});
Expand Down
Loading

0 comments on commit c470992

Please sign in to comment.