@theholocron/cli 2.0.0-alpha.11 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +21 -9
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -992,6 +992,8 @@ jobs:
|
|
|
992
992
|
statuses: write
|
|
993
993
|
runs-on: ubuntu-latest
|
|
994
994
|
timeout-minutes: 30
|
|
995
|
+
env:
|
|
996
|
+
GPG_KEY_SET: \${{ secrets.SUPER_LINTER_GPG_PRIVATE_KEY != '' }}
|
|
995
997
|
steps:
|
|
996
998
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
997
999
|
name: Checkout repository
|
|
@@ -1046,7 +1048,7 @@ jobs:
|
|
|
1046
1048
|
github.event.pull_request != null &&
|
|
1047
1049
|
github.event.pull_request.head.repo.full_name == github.repository &&
|
|
1048
1050
|
github.ref_name != github.event.repository.default_branch &&
|
|
1049
|
-
|
|
1051
|
+
env.GPG_KEY_SET == 'true'
|
|
1050
1052
|
with:
|
|
1051
1053
|
git_user_signingkey: true
|
|
1052
1054
|
git_commit_gpgsign: true
|
|
@@ -1060,7 +1062,7 @@ jobs:
|
|
|
1060
1062
|
github.event.pull_request != null &&
|
|
1061
1063
|
github.event.pull_request.head.repo.full_name == github.repository &&
|
|
1062
1064
|
github.ref_name != github.event.repository.default_branch &&
|
|
1063
|
-
|
|
1065
|
+
env.GPG_KEY_SET == 'true'
|
|
1064
1066
|
with:
|
|
1065
1067
|
branch: \${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
|
|
1066
1068
|
commit_message: "chore: fix linting issues"
|
|
@@ -1837,7 +1839,8 @@ async function runSyncGithub(input) {
|
|
|
1837
1839
|
};
|
|
1838
1840
|
}
|
|
1839
1841
|
let targetBranch = branch;
|
|
1840
|
-
|
|
1842
|
+
let defaultBranch;
|
|
1843
|
+
if (!targetBranch || createPr) {
|
|
1841
1844
|
const repoRes = await fetchFn(`${API_BASE}/repos/${owner}/${repoName}`, { headers });
|
|
1842
1845
|
if (!repoRes.ok) {
|
|
1843
1846
|
const msg = "failed to fetch repo metadata";
|
|
@@ -1850,11 +1853,13 @@ async function runSyncGithub(input) {
|
|
|
1850
1853
|
message: msg
|
|
1851
1854
|
};
|
|
1852
1855
|
}
|
|
1853
|
-
|
|
1856
|
+
defaultBranch = (await repoRes.json()).default_branch;
|
|
1857
|
+
if (!targetBranch) targetBranch = defaultBranch;
|
|
1854
1858
|
}
|
|
1855
|
-
const
|
|
1859
|
+
const baseBranch = createPr && defaultBranch ? defaultBranch : targetBranch;
|
|
1860
|
+
const refRes = await fetchFn(`${API_BASE}/repos/${owner}/${repoName}/git/ref/heads/${baseBranch}`, { headers });
|
|
1856
1861
|
if (!refRes.ok) {
|
|
1857
|
-
const msg = `Branch ${
|
|
1862
|
+
const msg = `Branch ${baseBranch} not found`;
|
|
1858
1863
|
print(` ✗ ${msg}`);
|
|
1859
1864
|
return {
|
|
1860
1865
|
status: "fail",
|
|
@@ -1977,13 +1982,20 @@ async function runSyncGithub(input) {
|
|
|
1977
1982
|
};
|
|
1978
1983
|
}
|
|
1979
1984
|
const { sha: newCommitSha } = await newCommitRes.json();
|
|
1980
|
-
const
|
|
1985
|
+
const refUpdateRes = createPr && branch ? await fetchFn(`${API_BASE}/repos/${owner}/${repoName}/git/refs`, {
|
|
1986
|
+
method: "POST",
|
|
1987
|
+
headers,
|
|
1988
|
+
body: JSON.stringify({
|
|
1989
|
+
ref: `refs/heads/${branch}`,
|
|
1990
|
+
sha: newCommitSha
|
|
1991
|
+
})
|
|
1992
|
+
}) : await fetchFn(`${API_BASE}/repos/${owner}/${repoName}/git/refs/heads/${targetBranch}`, {
|
|
1981
1993
|
method: "PATCH",
|
|
1982
1994
|
headers,
|
|
1983
1995
|
body: JSON.stringify({ sha: newCommitSha })
|
|
1984
1996
|
});
|
|
1985
|
-
if (!
|
|
1986
|
-
const msg = `failed to update ref: ${(await
|
|
1997
|
+
if (!refUpdateRes.ok) {
|
|
1998
|
+
const msg = `failed to update ref: ${(await refUpdateRes.json()).message ?? refUpdateRes.status}`;
|
|
1987
1999
|
print(` ✗ ${msg}`);
|
|
1988
2000
|
return {
|
|
1989
2001
|
status: "fail",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/cli",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"description": "The Holocron CLI — a pluggable, capability-based orchestrator for spinning up and operating software projects.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/holocron/tree/main/packages/cli#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/holocron/issues",
|