13 Commits

6 changed files with 31 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 - 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 }}

View File

@@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.1.1] - 2021-12-09
### Added
- icon
## [0.1.0] - 2021-12-07
### Added
- Overwrite button in error message
## [0.0.3] - 2021-12-07 ## [0.0.3] - 2021-12-07
### Fixed ### Fixed
- Small fixes - Small fixes
## [0.0.2] - 2021-12-06 ## [0.0.2] - 2021-12-06
### Added ### Added
- README 😂 - README 😂

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

2126
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -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.1",
"preview": true, "preview": false,
"engines": { "engines": {
"vscode": "^1.62.0" "vscode": "^1.62.0"
}, },
@@ -19,6 +19,7 @@
"type": "git", "type": "git",
"url": "https://github.com/maksim77/gitcheck.git" "url": "https://github.com/maksim77/gitcheck.git"
}, },
"icon": "media/folder-green-git-icon.png",
"activationEvents": [ "activationEvents": [
"workspaceContains:.git/" "workspaceContains:.git/"
], ],
@@ -66,7 +67,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"
} }
} }

View File

@@ -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);
}
} }
} }
}); });