Skip to content

Commit 4570309

Browse files
authored
Merge pull request #88 from GrantBirki/tlc
TLC and General Improvements
2 parents ecddbcf + 0be96a1 commit 4570309

File tree

12 files changed

+511
-364
lines changed

12 files changed

+511
-364
lines changed

.github/copilot-instructions.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copilot Instructions
2+
3+
You are an AI assistant that specializes in software development for the JavaScript programming language. Specifically, you are an expert in using JavaScript to build custom (native) GitHub Actions.
4+
5+
## Environment Setup
6+
7+
Bootstrap the project by running:
8+
9+
```bash
10+
npm install
11+
```
12+
13+
## Testing
14+
15+
Ensure all unit tests pass by running the following:
16+
17+
```bash
18+
npm run test
19+
```
20+
21+
This project should include unit tests for everything.
22+
23+
This project **requires 100% test coverage** of code.
24+
25+
Unit tests should exist in the `__tests__` directory. They are powered by `jest`.
26+
27+
An important note about tests is that you might get a warning/error when running `npm run test` related to problems with the coverage badge due to network troubles. If this is the case, please swap to using `npm run ci-test` instead. This will run the tests and generate the coverage report without trying to create a coverage badge.
28+
29+
## Bundling
30+
31+
The final commit should always be a bundle of the code. This is done by running the following command:
32+
33+
```bash
34+
npm run all
35+
```
36+
37+
This uses Vercel's `ncc` to bundle JS code for running in GitHub Actions.
38+
39+
## Project Guidelines
40+
41+
- Follow:
42+
- Object-Oriented best practices, especially abstraction and encapsulation
43+
- GRASP Principles, especially Information Expert, Creator, Indirection, Low Coupling, High Cohesion, and Pure Fabrication
44+
- SOLID principles, especially Dependency Inversion, Open/Closed, and Single Responsibility
45+
- Base new work on latest `main` branch
46+
- Changes should maintain consistency with existing patterns and style.
47+
- Document changes clearly and thoroughly, including updates to existing comments when appropriate. Try to use the same "voice" as the other comments, mimicking their tone and style.
48+
- When responding to code refactoring suggestions, function suggestions, or other code changes, please keep your responses as concise as possible. We are capable engineers and can understand the code changes without excessive explanation. If you feel that a more detailed explanation is necessary, you can provide it, but keep it concise. After doing any refactoring, ensure to run `npm run test` to ensure that all tests still pass.
49+
- When suggesting code changes, always opt for the most maintainable approach. Try your best to keep the code clean and follow DRY principles. Avoid unnecessary complexity and always consider the long-term maintainability of the code.
50+
- When writing unit tests, try to consider edge cases as well as the main path of success. This will help ensure that the code is robust and can handle unexpected inputs or situations.
51+
- Hard-coded strings should almost always be constant variables.
52+
- In writing code, take the following as preferences but not rules:
53+
- understandability over concision
54+
- syntax, expressions, and blocks that are common across many languages over language-specific syntax.
55+
- more descriptive names over brevity of variable, function, and class names
56+
- the use of whitespace (newlines) over compactness of files
57+
- naming of variables and methods that lead to expressions and blocks reading more like English sentences.
58+
- less lines of code over more. Keep changes minimal and focused.
59+
60+
## Pull Request Requirements
61+
62+
- All tests must pass.
63+
- The linter must pass.
64+
- Documentation must be up-to-date.
65+
- The body of the Pull Request should:
66+
- contain a summary of the changes
67+
- make special note of any changes to dependencies
68+
- comment on the security of the changes being made and offer suggestions for further securing the code
69+
70+
## Repository Organization
71+
72+
- `.github/` - GitHub configurations and settings
73+
- `docs/` - Main documentation storage
74+
- `script/` - Repository maintenance scripts
75+
- `src/` - Main code for the project. This is where the main application/service code lives
76+
- `__tests__/` - Tests for the project. This is where the unit tests live
77+
- `dist/` - This is where the JS compiled code lives for the GitHub Action
78+
- `action.yml` - The GitHub Action file. This is where the GitHub Action is defined

.github/workflows/acceptance-test.yml renamed to .github/workflows/acceptance.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: acceptance-test
1+
name: acceptance
22

33
on:
44
pull_request:
@@ -11,7 +11,7 @@ permissions:
1111
pull-requests: write
1212

1313
jobs:
14-
test:
14+
acceptance:
1515
runs-on: ubuntu-latest
1616
steps:
1717
# Need to checkout for testing the Action in this repo
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Allows you to test the setup steps from your repository's "Actions" tab
4+
on: workflow_dispatch
5+
6+
jobs:
7+
copilot-setup-steps:
8+
runs-on: ubuntu-latest
9+
# Set the permissions to the lowest permissions possible needed for *your steps*. Copilot will be given its own token for its operations.
10+
permissions:
11+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
12+
contents: read
13+
steps:
14+
- name: checkout
15+
uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: setup node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: .node-version
23+
cache: 'npm'
24+
25+
- name: install dependencies
26+
run: npm install

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# JSON and YAML - Validator ✅
22

3-
[![CodeQL](https://github.com/grantbirki/json-yaml-validate/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/codeql-analysis.yml) [![test](https://github.com/grantbirki/json-yaml-validate/actions/workflows/test.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/test.yml) [![acceptance-test](https://github.com/GrantBirki/json-yaml-validate/actions/workflows/acceptance-test.yml/badge.svg)](https://github.com/GrantBirki/json-yaml-validate/actions/workflows/acceptance-test.yml) [![package-check](https://github.com/grantbirki/json-yaml-validate/actions/workflows/package-check.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/package-check.yml) [![lint](https://github.com/grantbirki/json-yaml-validate/actions/workflows/lint.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/lint.yml) [![coverage](./badges/coverage.svg)](./badges/coverage.svg)
3+
[![CodeQL](https://github.com/grantbirki/json-yaml-validate/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/codeql-analysis.yml)
4+
[![test](https://github.com/grantbirki/json-yaml-validate/actions/workflows/test.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/test.yml)
5+
[![acceptance](https://github.com/GrantBirki/json-yaml-validate/actions/workflows/acceptance.yml/badge.svg)](https://github.com/GrantBirki/json-yaml-validate/actions/workflows/acceptance.yml)
6+
[![package-check](https://github.com/grantbirki/json-yaml-validate/actions/workflows/package-check.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/package-check.yml)
7+
[![lint](https://github.com/grantbirki/json-yaml-validate/actions/workflows/lint.yml/badge.svg)](https://github.com/grantbirki/json-yaml-validate/actions/workflows/lint.yml)
8+
[![coverage](./badges/coverage.svg)](./badges/coverage.svg)
49

510
A GitHub Action to quickly validate JSON and YAML files in a repository
611

@@ -134,7 +139,7 @@ This Action also supports schema validation for both JSON and YAML files.
134139
References docs for both JSON and YAML schema validation can be found at the links below:
135140

136141
- [JSON Schema Validation Docs](https://ajv.js.org/json-schema.html#json-schema)
137-
- [YAML Schema Validation Docs](https://github.com/ketanSaxena/schema-validator#yaml-schema) - Additional docs [here](https://www.npmjs.com/package/validate)
142+
- [YAML Schema Validation Docs](https://github.com/ketanSaxena/schema-validator#yaml-schema) - Additional docs [can be found here](https://www.npmjs.com/package/validate)
138143

139144
> Note: JSON files and YAML files use two separate libraries for schema validation
140145

0 commit comments

Comments
 (0)