Add lint to workflow (#88)
* Add lint in workflow This will check for code formatting, as well as for any ES lint issues. * Format code run `npm run check:write` * Run lint and fix errors Run `npm run lint` and then fix the errors shown.
This commit is contained in:
13
.github/workflows/lint.yml
vendored
13
.github/workflows/lint.yml
vendored
@@ -14,3 +14,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ignore_paths: >-
|
ignore_paths: >-
|
||||||
.husky
|
.husky
|
||||||
|
- name: Setup Node.js
|
||||||
|
id: setup-node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: npm
|
||||||
|
- name: Install Dependencies
|
||||||
|
id: install
|
||||||
|
run: npm ci
|
||||||
|
- name: Check formatting
|
||||||
|
run: npm run format:check
|
||||||
|
- name: Check lint
|
||||||
|
run: npm run lint
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
Thank you for your interest in contributing to the 1Password load-secrets-action project 👋! Before you start, please take a moment to read through this guide to understand our contribution process.
|
Thank you for your interest in contributing to the 1Password load-secrets-action project 👋! Before you start, please take a moment to read through this guide to understand our contribution process.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Unit tests can be run with `npm run test`.
|
Unit tests can be run with `npm run test`.
|
||||||
|
|
||||||
After following the steps below for signing commits, you can test against your PR with these steps:
|
After following the steps below for signing commits, you can test against your PR with these steps:
|
||||||
@@ -13,7 +14,9 @@ After following the steps below for signing commits, you can test against your P
|
|||||||
```yaml
|
```yaml
|
||||||
uses: 1Password/load-secrets-action@<branch-name>
|
uses: 1Password/load-secrets-action@<branch-name>
|
||||||
```
|
```
|
||||||
|
|
||||||
OR
|
OR
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: 1Password/load-secrets-action@<commit-hash>
|
uses: 1Password/load-secrets-action@<commit-hash>
|
||||||
```
|
```
|
||||||
|
|||||||
3847
package-lock.json
generated
3847
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -39,24 +39,24 @@ describe("validateAuth", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should throw an error when no config is provided", () => {
|
it("should throw an error when no config is provided", () => {
|
||||||
expect(validateAuth).toThrowError(authErr);
|
expect(validateAuth).toThrow(authErr);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw an error when partial Connect config is provided", () => {
|
it("should throw an error when partial Connect config is provided", () => {
|
||||||
process.env[envConnectHost] = testConnectHost;
|
process.env[envConnectHost] = testConnectHost;
|
||||||
expect(validateAuth).toThrowError(authErr);
|
expect(validateAuth).toThrow(authErr);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be authenticated as a Connect client", () => {
|
it("should be authenticated as a Connect client", () => {
|
||||||
process.env[envConnectHost] = testConnectHost;
|
process.env[envConnectHost] = testConnectHost;
|
||||||
process.env[envConnectToken] = testConnectToken;
|
process.env[envConnectToken] = testConnectToken;
|
||||||
expect(validateAuth).not.toThrowError(authErr);
|
expect(validateAuth).not.toThrow(authErr);
|
||||||
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be authenticated as a service account", () => {
|
it("should be authenticated as a service account", () => {
|
||||||
process.env[envServiceAccountToken] = testServiceAccountToken;
|
process.env[envServiceAccountToken] = testServiceAccountToken;
|
||||||
expect(validateAuth).not.toThrowError(authErr);
|
expect(validateAuth).not.toThrow(authErr);
|
||||||
expect(core.info).toHaveBeenCalledWith(
|
expect(core.info).toHaveBeenCalledWith(
|
||||||
"Authenticated with Service account.",
|
"Authenticated with Service account.",
|
||||||
);
|
);
|
||||||
@@ -66,7 +66,7 @@ describe("validateAuth", () => {
|
|||||||
process.env[envServiceAccountToken] = testServiceAccountToken;
|
process.env[envServiceAccountToken] = testServiceAccountToken;
|
||||||
process.env[envConnectHost] = testConnectHost;
|
process.env[envConnectHost] = testConnectHost;
|
||||||
process.env[envConnectToken] = testConnectToken;
|
process.env[envConnectToken] = testConnectToken;
|
||||||
expect(validateAuth).not.toThrowError(authErr);
|
expect(validateAuth).not.toThrow(authErr);
|
||||||
expect(core.warning).toHaveBeenCalled();
|
expect(core.warning).toHaveBeenCalled();
|
||||||
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user