Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
99bc7cb73e
|
|||
|
d4c2614d8e
|
|||
|
98873d8be2
|
|||
|
50f4015f30
|
|||
|
cb3ccbb4f6
|
|||
|
5e776f686b
|
|||
|
3c9a3f8168
|
|||
|
fdd72009b9
|
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@@ -82,9 +82,6 @@ jobs:
|
|||||||
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
|
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
|
||||||
- uses: actions/create-release@v1
|
- uses: actions/create-release@v1
|
||||||
id: create_release
|
id: create_release
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
tag_name: ${{ github.ref }}
|
||||||
release_name: ${{ github.ref }}
|
release_name: ${{ github.ref }}
|
||||||
@@ -92,10 +89,6 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
- uses: actions/upload-release-asset@v1
|
- uses: actions/upload-release-asset@v1
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
||||||
DISPLAY: ":99.0"
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ${{ env.VSIX_PATH }}
|
asset_path: ${{ env.VSIX_PATH }}
|
||||||
|
|||||||
2126
package-lock.json
generated
2126
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,8 @@
|
|||||||
"name": "gitcheck",
|
"name": "gitcheck",
|
||||||
"displayName": "Git User Check",
|
"displayName": "Git User Check",
|
||||||
"description": "Checking the user's compliance with the repository",
|
"description": "Checking the user's compliance with the repository",
|
||||||
"version": "0.0.3",
|
"version": "0.1.0",
|
||||||
"preview": true,
|
"preview": false,
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.62.0"
|
"vscode": "^1.62.0"
|
||||||
},
|
},
|
||||||
@@ -66,7 +66,6 @@
|
|||||||
"eslint": "^8.1.0",
|
"eslint": "^8.1.0",
|
||||||
"glob": "^7.1.7",
|
"glob": "^7.1.7",
|
||||||
"mocha": "^9.1.3",
|
"mocha": "^9.1.3",
|
||||||
"typescript": "^4.4.4",
|
"typescript": "^4.4.4"
|
||||||
"vsce": "^2.5.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export async function activate() {
|
|||||||
const email = conf.get<string>("email");
|
const email = conf.get<string>("email");
|
||||||
|
|
||||||
if (!vscode.workspace.workspaceFolders) {
|
if (!vscode.workspace.workspaceFolders) {
|
||||||
|
console.log("No opened workspace");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,12 +20,14 @@ export async function activate() {
|
|||||||
const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!;
|
const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!;
|
||||||
const git = gitExt.exports.getAPI(1);
|
const git = gitExt.exports.getAPI(1);
|
||||||
if (!git) {
|
if (!git) {
|
||||||
|
console.log("Git extension disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
|
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
|
||||||
|
|
||||||
if (!repository) {
|
if (!repository) {
|
||||||
|
console.error("Cannot open git repository");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +41,12 @@ export async function activate() {
|
|||||||
return elem.key === "user.name" || elem.key === "user.email";
|
return elem.key === "user.name" || elem.key === "user.email";
|
||||||
});
|
});
|
||||||
if (gitConfig.length === 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
gitConfig.forEach(c => {
|
gitConfig.forEach(c => {
|
||||||
@@ -52,11 +60,16 @@ export async function activate() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.log(c.key);
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (gitName !== name || gitEmail !== email) {
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user