Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
3560e9f93b
|
|||
|
5e70f0da6b
|
|||
|
bf14a00b38
|
|||
|
3b1a55ea0a
|
|||
|
926b050a63
|
|||
|
7e8621f6b2
|
|||
|
e1b1b4a16a
|
|||
|
ec9ab4174b
|
|||
|
90cdb968bc
|
104
.github/workflows/main.yml
vendored
Normal file
104
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
name: "Main"
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: Lint
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "14"
|
||||
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
|
||||
shell: bash
|
||||
- run: npm install
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- run: npm run lint
|
||||
env:
|
||||
DISPLAY: ":99.0"
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint
|
||||
name: Package
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "14"
|
||||
- run: npm install
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- run: npm install -g vsce
|
||||
- run: vsce package
|
||||
- run: echo "VSIX_PATH=$(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/upload-artifact@v2
|
||||
with:
|
||||
path: ${{ env.VSIX_PATH }}
|
||||
name: ${{ env.VSIX_NAME }}
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: package
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
DISPLAY: ":99.0"
|
||||
name: Release
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "14"
|
||||
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
|
||||
shell: bash
|
||||
- run: npm install
|
||||
- run: npm install -g vsce
|
||||
- run: vsce package
|
||||
- run: echo "VSIX_PATH=$(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
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
body: See [CHANGE LOG](https://github.com/maksim77/gitcheck/blob/main/CHANGELOG.md) for details.
|
||||
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 }}
|
||||
asset_name: ${{ env.VSIX_NAME }}
|
||||
asset_content_type: application/zip
|
||||
- run: vsce publish
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
out
|
||||
.vscode-test/
|
||||
|
||||
@@ -3,7 +3,11 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
## [0.0.2] - 2021-12-06
|
||||
|
||||
## [0.0.3] - 2021-12-07
|
||||
### Fixed
|
||||
- Small fixes
|
||||
## [0.0.2] - 2021-12-06
|
||||
### Added
|
||||
- README 😂
|
||||
### Changed
|
||||
|
||||
@@ -4,6 +4,6 @@ Sometimes, after cloning a repository from a corporate server and having already
|
||||
This extension is written to avoid this.
|
||||
|
||||
## Configuration
|
||||
* `gitcheck.domain` – The domain (or just a substring) for which the check will be performed (you can see in the output of the command `git remote -v`)&
|
||||
* `gitcheck.domain` – The domain (or just a substring) for which the check will be performed (you can see in the output of the command `git remote -v`).
|
||||
* `gitcheck.name` – This value will be checked against the value of the git parameter `user.name`.
|
||||
* `gitcheck.email` – This value will be checked against the value of the git parameter `user.email`.
|
||||
2126
package-lock.json
generated
2126
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
137
package.json
137
package.json
@@ -1,71 +1,72 @@
|
||||
{
|
||||
"name": "gitcheck",
|
||||
"displayName": "Git User Check",
|
||||
"description": "Checking the user's compliance with the repository",
|
||||
"version": "0.0.2",
|
||||
"preview": true,
|
||||
"engines": {
|
||||
"vscode": "^1.62.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"author": {
|
||||
"name": "Maksim Syomochkin",
|
||||
"email": "maksim77ster@gmail.com"
|
||||
},
|
||||
"publisher": "mak-sim",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maksim77/gitcheck.git"
|
||||
},
|
||||
"activationEvents": [
|
||||
"workspaceContains:.git/"
|
||||
],
|
||||
"extensionDependencies": [
|
||||
"vscode.git"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"configuration":[
|
||||
{
|
||||
"title": "Git User Check",
|
||||
"properties": {
|
||||
"gitcheck.domain": {
|
||||
"type": "string",
|
||||
"description": "Remote domain for check"
|
||||
},
|
||||
"gitcheck.name": {
|
||||
"type":"string",
|
||||
"description": "user.name for gitcheck domain"
|
||||
},
|
||||
"gitcheck.email": {
|
||||
"type":"string",
|
||||
"description": "user.email for gitcheck domain"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"pretest": "npm run compile && npm run lint",
|
||||
"lint": "eslint src --ext ts",
|
||||
"test": "node ./out/test/runTest.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/vscode": "^1.62.0",
|
||||
"@types/glob": "^7.1.4",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "14.17.27",
|
||||
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
||||
"@typescript-eslint/parser": "^5.1.0",
|
||||
"eslint": "^8.1.0",
|
||||
"glob": "^7.1.7",
|
||||
"mocha": "^9.1.3",
|
||||
"typescript": "^4.4.4",
|
||||
"@vscode/test-electron": "^1.6.2"
|
||||
}
|
||||
"displayName": "Git User Check",
|
||||
"description": "Checking the user's compliance with the repository",
|
||||
"version": "0.0.3",
|
||||
"preview": true,
|
||||
"engines": {
|
||||
"vscode": "^1.62.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"author": {
|
||||
"name": "Maksim Syomochkin",
|
||||
"email": "maksim77ster@gmail.com"
|
||||
},
|
||||
"publisher": "mak-sim",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maksim77/gitcheck.git"
|
||||
},
|
||||
"activationEvents": [
|
||||
"workspaceContains:.git/"
|
||||
],
|
||||
"extensionDependencies": [
|
||||
"vscode.git"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
"configuration": [
|
||||
{
|
||||
"title": "Git User Check",
|
||||
"properties": {
|
||||
"gitcheck.domain": {
|
||||
"type": "string",
|
||||
"description": "Remote domain for check"
|
||||
},
|
||||
"gitcheck.name": {
|
||||
"type": "string",
|
||||
"description": "user.name for gitcheck domain"
|
||||
},
|
||||
"gitcheck.email": {
|
||||
"type": "string",
|
||||
"description": "user.email for gitcheck domain"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"pretest": "npm run compile && npm run lint",
|
||||
"lint": "eslint src --ext ts",
|
||||
"test": "node ./out/test/runTest.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/glob": "^7.1.4",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "14.17.27",
|
||||
"@types/vscode": "^1.62.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.1.0",
|
||||
"@typescript-eslint/parser": "^5.1.0",
|
||||
"@vscode/test-electron": "^1.6.2",
|
||||
"eslint": "^8.1.0",
|
||||
"glob": "^7.1.7",
|
||||
"mocha": "^9.1.3",
|
||||
"typescript": "^4.4.4",
|
||||
"vsce": "^2.5.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,12 @@ export async function activate() {
|
||||
return;
|
||||
}
|
||||
|
||||
const git = vscode.extensions.getExtension<GitExtension>('vscode.git')!.exports.getAPI(1)!;
|
||||
const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!;
|
||||
const git = gitExt.exports.getAPI(1);
|
||||
if (!git) {
|
||||
return;
|
||||
}
|
||||
|
||||
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
|
||||
|
||||
if (!repository) {
|
||||
|
||||
Reference in New Issue
Block a user