From 796e46d215df6ddb83bed99c888b81f96008ba8f Mon Sep 17 00:00:00 2001 From: Miguel Ramos Date: Mon, 22 Jul 2024 10:19:39 +0100 Subject: [PATCH 1/5] feat: add message --- packages/package-a/index.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/package-a/index.mjs b/packages/package-a/index.mjs index b7d684e..0730188 100644 --- a/packages/package-a/index.mjs +++ b/packages/package-a/index.mjs @@ -1 +1,2 @@ export const message = 'hello world!'; +export const add = (msg) => message + msg; From a9f18f813e3848b4ba55783f54d13fb6506ecf15 Mon Sep 17 00:00:00 2001 From: Miguel Ramos Date: Mon, 22 Jul 2024 10:22:58 +0100 Subject: [PATCH 2/5] chore: changes maintenance --- .changes.json | 2 +- index.mjs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.changes.json b/.changes.json index e474234..4ca89e7 100644 --- a/.changes.json +++ b/.changes.json @@ -1 +1 @@ -{ "message": "chore(release): release new version", "changes": {} } +{"message":"chore(release): release new version","changes":{"feature/action-changes":[{"package":"@scope/package-a","release_as":"Minor","deploy":["int"]}]}} \ No newline at end of file diff --git a/index.mjs b/index.mjs index 9f0ff9e..cd487ce 100644 --- a/index.mjs +++ b/index.mjs @@ -1,4 +1,12 @@ -import { getChangedPackages } from '@websublime/workspace-tools'; -import { log } from './test.mjs'; +import { + getChangedPackages, + addChange, + Bump, +} from "@websublime/workspace-tools"; +import { log } from "./test.mjs"; -log(getChangedPackages('main', process.cwd())); +addChange( + { deploy: ["int"], package: "@scope/package-a", releaseAs: Bump.Minor }, + process.cwd(), +); +log(getChangedPackages("main", process.cwd())); From 954bcc5538adee954aa7f9974913411e935473ef Mon Sep 17 00:00:00 2001 From: Miguel Ramos Date: Mon, 22 Jul 2024 10:37:36 +0100 Subject: [PATCH 3/5] chore: fail safe to current commit id --- actions.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/actions.mjs b/actions.mjs index 393136c..61b78da 100644 --- a/actions.mjs +++ b/actions.mjs @@ -3,6 +3,7 @@ import { getChange, removeChange, getChangedPackages, + gitCurrentSha, } from "@websublime/workspace-tools"; import { inspect } from "node:util"; @@ -32,7 +33,8 @@ export function getActionInfo({ context, root, branch, repoName }) { context?.payload?.before ?? context?.payload?.pull_request?.head?.sha, commitIdAfter: context?.payload?.after ?? - context?.payload?.pull_request?.merge_commit_sha, + context?.payload?.pull_request?.merge_commit_sha ?? + gitCurrentSha(projectRoot), ref, eventName: context?.eventName, headRef, From d939cd31f9e7f9f75e750e4c3a012c349ce4bcbf Mon Sep 17 00:00:00 2001 From: Miguel Ramos Date: Mon, 22 Jul 2024 10:59:32 +0100 Subject: [PATCH 4/5] chore: add title to ActionInfo interface --- actions.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/actions.mjs b/actions.mjs index 61b78da..2af2242 100644 --- a/actions.mjs +++ b/actions.mjs @@ -16,6 +16,7 @@ export function getActionInfo({ context, root, branch, repoName }) { let ref = context?.ref ?? context?.payload?.ref; let headRef = context?.payload?.pull_request?.head?.ref ?? branch; let isMerge = Boolean(context?.payload?.pull_request?.merged); + let title = context?.payload?.pull_request?.title; if (isMerge && headRef) { removeChange(headRef, projectRoot); @@ -25,6 +26,7 @@ export function getActionInfo({ context, root, branch, repoName }) { let packages = getChangedPackages("origin/main", projectRoot); return { + title, branch, change, packages, From d75e8d600c57c6239bc1a3fc796da1c6dbfbbf48 Mon Sep 17 00:00:00 2001 From: Miguel Ramos Date: Mon, 22 Jul 2024 11:05:31 +0100 Subject: [PATCH 5/5] chore: hasPackagesChanges on ActionInfo interface --- actions.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/actions.mjs b/actions.mjs index 2af2242..1d82b45 100644 --- a/actions.mjs +++ b/actions.mjs @@ -41,6 +41,7 @@ export function getActionInfo({ context, root, branch, repoName }) { eventName: context?.eventName, headRef, isMerge, + hasPackagesChanges: packages.length > 0, repoName, }; }