@yukiakai/actions-git 1.0.6 → 1.0.7
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/public.js +1 -1
- package/package.json +4 -2
package/dist/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as
|
|
1
|
+
import{exec as a}from"@actions/exec";var i=class{constructor(t){this.options=t}get repoUrl(){let{repo:t,token:e}=this.options;return`https://x-access-token:${e}@github.com/${t}.git`}async execGitRaw(t,e){return{exitCode:await a("git",t,e)}}async execGit(t,e){return await this.execGitRaw(t,{cwd:this.options.cwd,...e})}async execGitInspectable(t,e){return await this.execGit(t,{...e,ignoreReturnCode:!0})}async clone(){let{branch:t,cwd:e}=this.options;(await this.execGitRaw(["clone","--depth=1","--branch",t,this.repoUrl,e],{ignoreReturnCode:!0})).exitCode!==0&&await this.execGitRaw(["clone",this.repoUrl,e])}async wipe(t){await this.execGit(["rm","-r","-f","--ignore-unmatch",...t]),await this.execGit(["clean","-fdx","--",...t])}async setup(){await this.execGit(["config","user.name","github-actions[bot]"]),await this.execGit(["config","user.email","github-actions[bot]@users.noreply.github.com"])}async checkout(){let{branch:t}=this.options;await this.branchExists(t)?await this.execGit(["checkout",t]):(await this.execGit(["checkout","--orphan",t]),await this.wipe(["."]))}async pullRebase(){let{branch:t}=this.options;await this.execGit(["pull","--rebase","origin",t])}async commit(t){await this.execGit(["commit","-m",t])}async add(t){await this.execGit(["add",...t])}async push(){let{branch:t}=this.options;await this.execGit(["push","origin",t])}async hasChanges(){let t=await this.execGitInspectable(["diff","--cached","--quiet"]);if(t.exitCode===0)return!1;if(t.exitCode===1)return!0;throw new Error(`git diff failed with exit code ${t.exitCode}`)}async branchExists(t){let e=await this.execGitInspectable(["ls-remote","--exit-code","--heads","origin",t]);if(e.exitCode===0)return!0;if(e.exitCode===2)return!1;throw new Error(`Failed to check remote branch "${t}" (exit code ${e.exitCode})`)}};export{i as GitClient};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yukiakai/actions-git",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Lightweight Git client for GitHub Actions and CI workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/public.js",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"format:check": "prettier --check **/*.{js,ts,json}",
|
|
16
16
|
"lint": "eslint src/**/*.ts",
|
|
17
17
|
"typecheck:workspace": "tsc -p tsconfig.workspace.json",
|
|
18
|
+
"generate:types": "npx type-export-builder generate -p src/_public.ts",
|
|
18
19
|
"build": "npx tsup",
|
|
19
|
-
"build:public": "npx tsup --config tsup.public.config.ts",
|
|
20
|
+
"build:public": "npm run generate:types && npx tsup --config tsup.public.config.ts",
|
|
20
21
|
"docs": "npx typedoc",
|
|
21
22
|
"prepare:artifact": "tsx workspace/release/prepareArtifact.ts",
|
|
22
23
|
"prepare": "is-ci || husky"
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"prettier": "^3.6.2",
|
|
65
66
|
"tsup": "^8.5.1",
|
|
66
67
|
"tsx": "^4.20.3",
|
|
68
|
+
"type-export-builder": "^1.1.0",
|
|
67
69
|
"typedoc": "^0.28.9",
|
|
68
70
|
"typescript": "^5.8.3",
|
|
69
71
|
"typescript-eslint": "^8.35.1",
|