Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cdupuis committed May 4, 2022
1 parent 350aee6 commit ebe4d67
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 73 deletions.
26 changes: 0 additions & 26 deletions datalog/subscription/build_on_push.edn

This file was deleted.

28 changes: 0 additions & 28 deletions datalog/subscription/build_on_tag.edn

This file was deleted.

9 changes: 7 additions & 2 deletions lib/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
repository,
retry,
runSteps,
secret,
status,
Step,
tmpFs,
Expand Down Expand Up @@ -67,7 +68,9 @@ const LoadProjectStep: NpmStep = {
repository.gitHub({
owner: repo.owner,
repo: repo.name,
credential: { token: repo.installationToken, scopes: [] },
credential: await ctx.credential.resolve(
secret.gitHubAppTokenFromRepository(ctx.data.commit),
),
}),
);
params.project = project;
Expand Down Expand Up @@ -418,7 +421,9 @@ const NpmVersionStep: NpmStep = {
}
} else {
const octokit = github.api({
credential: { token: repo.installationToken, scopes: [] },
credential: await ctx.credential.resolve(
secret.gitHubAppTokenFromRepository(ctx.data.commit),
),
});

try {
Expand Down
8 changes: 4 additions & 4 deletions lib/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export function nextPrereleaseTag(args: NextPrereleaseTagArgs): string {
return semver.inc(sortedTags[0], "prerelease");
}

export type EventSubscription = subscription.datalog.OnPush;
export type EventSubscription =
| subscription.datalog.OnPush
| subscription.datalog.OnTag;

/** Extract commit from event data. */
export function eventCommit(data: EventSubscription): {
Expand All @@ -90,14 +92,12 @@ export function eventRepo(data: EventSubscription): {
defaultBranch?: string;
name?: string;
owner?: string;
installationToken: string;
} {
return {
channels: [],
name: data.commit.repo.name,
owner: data.commit.repo.org.name,
defaultBranch: data.commit.repo.defaultBranch,
installationToken: data.commit.repo.org.installationToken,
};
}

Expand All @@ -114,5 +114,5 @@ export function eventBranch(data: EventSubscription): string | undefined {
* commit-triggered events.
*/
export function eventTag(data: EventSubscription): string | undefined {
return undefined;
return (data as subscription.datalog.OnTag).ref?.name;
}
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"test:one": "mocha --require espower-typescript/guess \"test/**/${TEST:-*.test.ts}\""
},
"dependencies": {
"@atomist/skill": "^0.12.0-main.20",
"@atomist/skill": "^0.12.0-main.25",
"fs-extra": "^10.1.0",
"p-retry": "^5.1.1",
"semver": "^7.3.7"
Expand Down
5 changes: 5 additions & 0 deletions skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,9 @@ export const Skill = skill<
},
repos: parameter.repoFilter(),
},

datalogSubscriptions: [
{ name: "build_on_push", query: "@atomist/skill/on_push" },
{ name: "build_on_tag", query: "@atomist/skill/on_tag" },
],
});

0 comments on commit ebe4d67

Please sign in to comment.