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:
|
||||||
@@ -10,13 +11,15 @@ After following the steps below for signing commits, you can test against your P
|
|||||||
1. Create or use an existing repo to run the `load-secrets` GitHub Action.
|
1. Create or use an existing repo to run the `load-secrets` GitHub Action.
|
||||||
2. In a workflow yaml file that uses the GitHub Action, modify the `uses: 1Password/load-secrets-action` line to be
|
2. In a workflow yaml file that uses the GitHub Action, modify the `uses: 1Password/load-secrets-action` line to be
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: 1Password/load-secrets-action@<branch-name>
|
uses: 1Password/load-secrets-action@<branch-name>
|
||||||
```
|
```
|
||||||
OR
|
|
||||||
```yaml
|
OR
|
||||||
uses: 1Password/load-secrets-action@<commit-hash>
|
|
||||||
```
|
```yaml
|
||||||
|
uses: 1Password/load-secrets-action@<commit-hash>
|
||||||
|
```
|
||||||
|
|
||||||
3. Trigger the action, which now includes your changes.
|
3. Trigger the action, which now includes your changes.
|
||||||
|
|
||||||
@@ -48,4 +51,4 @@ Follow the steps below to set up commit signing with `gpg`:
|
|||||||
|
|
||||||
1. [Generate a GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)
|
1. [Generate a GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)
|
||||||
2. [Add the GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)
|
2. [Add the GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account)
|
||||||
3. [Configure git to use your GPG key for commits signing](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key#telling-git-about-your-gpg-key)
|
3. [Configure git to use your GPG key for commits signing](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key#telling-git-about-your-gpg-key)
|
||||||
|
|||||||
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