-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 564709a
Showing
7 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Dependency Review Action | ||
# | ||
# This Action will scan dependency manifest files that change as part of a Pull Request, | ||
# surfacing known-vulnerable versions of the packages declared or updated in the PR. | ||
# Once installed, if the workflow run is marked as required, | ||
# PRs introducing known-vulnerable packages will be blocked from merging. | ||
# | ||
# Source repository: https://github.com/actions/dependency-review-action | ||
name: 'Dependency Review' | ||
on: [pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: 'Checkout Repository' | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
- name: 'Dependency Review' | ||
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Run grit patterns test | ||
|
||
env: | ||
GRIT_TELEMETRY_DISABLED: "true" | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.runner }} | ||
|
||
strategy: | ||
matrix: | ||
runner: [nscloud-ubuntu-22.04-amd64-4x16] | ||
node-version: [20.x] | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v2.5.2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: install-ruff | ||
run: | | ||
pip install ruff | ||
- name: Install @getgrit/launcher | ||
run: npm install -g @getgrit/launcher | ||
|
||
- name: Run doctor | ||
run: npx grit doctor | ||
|
||
- name: Run grit patterns test | ||
run: npx grit patterns test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
engine.log | ||
.gritmodules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
version: 0.0.1 | ||
patterns: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
engine marzano(0.1) | ||
language universal | ||
|
||
pattern foo_to_bar() { | ||
contains `foo` => `bar` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Contributor Guide | ||
|
||
## Getting started | ||
|
||
Make sure you have the Grit CLI installed: | ||
|
||
```sh | ||
npm install -g @getgrit/launcher | ||
``` | ||
|
||
To propose changes, fork this repository and open a pull request. | ||
|
||
## Adding a new pattern | ||
|
||
All patterns require at least one sample validating the functionality. As a result, the best way to develop a | ||
GritQL pattern is often by starting with before and after sample(s) of the code to be transformed. You can | ||
iterate in the [GritQL studio](https://app.grit.io/studio) to develop your pattern. | ||
|
||
Once you have a pattern, you can add it to the repository by creating a new `.md` file in the `.grit/patterns` | ||
directory. The file name should be the snake-cased name of the pattern. Keep the file name short and | ||
descriptive, and add a concise description as well as any relevant tags. All PRs must contain at least | ||
one sample of before/after code with a descriptive name. | ||
|
||
## Testing | ||
|
||
Samples can be tested locally using the Grit CLI. | ||
|
||
```sh | ||
grit patterns test | ||
``` | ||
|
||
Once you have your sample(s) passing locally, creating a PR will automatically trigger a CI build running the same tests in a range of environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Grit Patterns | ||
|
||
This repository contains curated Grit patterns. | ||
|
||
## License | ||
|
||
This repository is licensed exclusively for usage with the Grit tool. | ||
All rights reserved. | ||
|
||
## Contributing | ||
|
||
We welcome contributions from the community. Please see the [contributing guide](CONTRIBUTING.md) for more information. |