8 Commits

Author SHA1 Message Date
99bc7cb73e bump version 2021-12-07 15:25:06 +03:00
d4c2614d8e remove vsce from npm deps 2021-12-07 15:24:31 +03:00
98873d8be2 simplify gh actions 2021-12-07 15:23:27 +03:00
50f4015f30 rename error message 2021-12-07 15:17:55 +03:00
cb3ccbb4f6 Add overwrite button 2021-12-07 15:17:19 +03:00
5e776f686b Change error message 2021-12-07 15:03:15 +03:00
3c9a3f8168 remove unused log from switch 2021-12-07 15:02:56 +03:00
fdd72009b9 add some logs 2021-12-07 15:02:14 +03:00
4 changed files with 22 additions and 2137 deletions

View File

@@ -82,9 +82,6 @@ jobs:
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
@@ -92,10 +89,6 @@ jobs:
draft: false
prerelease: false
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
DISPLAY: ":99.0"
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.VSIX_PATH }}

2126
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,8 +2,8 @@
"name": "gitcheck",
"displayName": "Git User Check",
"description": "Checking the user's compliance with the repository",
"version": "0.0.3",
"preview": true,
"version": "0.1.0",
"preview": false,
"engines": {
"vscode": "^1.62.0"
},
@@ -66,7 +66,6 @@
"eslint": "^8.1.0",
"glob": "^7.1.7",
"mocha": "^9.1.3",
"typescript": "^4.4.4",
"vsce": "^2.5.1"
"typescript": "^4.4.4"
}
}

View File

@@ -8,6 +8,7 @@ export async function activate() {
const email = conf.get<string>("email");
if (!vscode.workspace.workspaceFolders) {
console.log("No opened workspace");
return;
}
@@ -19,12 +20,14 @@ export async function activate() {
const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!;
const git = gitExt.exports.getAPI(1);
if (!git) {
console.log("Git extension disabled");
return;
}
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
if (!repository) {
console.error("Cannot open git repository");
return;
}
@@ -38,7 +41,12 @@ export async function activate() {
return elem.key === "user.name" || elem.key === "user.email";
});
if (gitConfig.length === 0) {
vscode.window.showErrorMessage("Missing user creds in git");
console.error("Missing user creds in git");
const option = await vscode.window.showErrorMessage("Missing user settings in git", "Overwrite");
if (option && option === "Overwrite") {
await repository.setConfig("user.name", name);
await repository.setConfig("user.email", email);
}
return;
}
gitConfig.forEach(c => {
@@ -52,11 +60,16 @@ export async function activate() {
break;
default:
console.log(c.key);
break;
}
});
if (gitName !== name || gitEmail !== email) {
vscode.window.showErrorMessage("Wrong user creds in git");
console.error("Wrong user settings in git");
const option = await vscode.window.showErrorMessage("Wrong user settings in git", "Overwrite");
if (option && option === "Overwrite") {
await repository.setConfig("user.name", name);
await repository.setConfig("user.email", email);
}
}
}
});