-
Notifications
You must be signed in to change notification settings - Fork 0
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 bdcb98d
Showing
20 changed files
with
15,059 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,2 @@ | ||
**/node_modules | ||
**/dist |
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,10 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
] | ||
} |
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,90 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- uses: pnpm/action-setup@v2.0.1 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
id: node-modules-cache | ||
with: | ||
path: "./node_modules" | ||
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: Install dependencies | ||
if: steps.node-moduels-cache.outputs.cache-hit != 'true' | ||
run: pnpm install --strict-peer-dependencies --frozen-lockfile | ||
lint: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- uses: pnpm/action-setup@v2.0.1 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: "./node_modules" | ||
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- run: pnpm lint | ||
test: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- uses: pnpm/action-setup@v2.0.1 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: "./node_modules" | ||
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- run: pnpm test:ci | ||
integration: | ||
needs: [prepare] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- uses: pnpm/action-setup@v2.0.1 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run action | ||
uses: ./ | ||
id: changed-package-action | ||
- name: echo changed packages | ||
run: echo ${{ steps.changed-package-action.outputs.changed-packages }} | ||
- name: echo CHANGE_DETECTED env | ||
run: echo ${{ env.CHANGE_DETECTED }} |
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,38 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
- uses: pnpm/action-setup@v2.0.1 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
- uses: actions/cache@v3 | ||
id: node-modules-cache | ||
with: | ||
path: "./node_modules" | ||
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: Install dependencies | ||
if: steps.node-moduels-cache.outputs.cache-hit != 'true' | ||
run: pnpm install --strict-peer-dependencies --frozen-lockfile | ||
- name: Build action | ||
run: pnpm build | ||
- name: Run semantic-release | ||
run: pnpm release --ci | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
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 @@ | ||
**/node_modules | ||
*.log |
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,8 @@ | ||
The MIT License | ||
Copyright © 2022 Akshay Ram Vignesh | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,79 @@ | ||
# cambios | ||
|
||
Github action to detect if there are any changes in pnpm workspace or repository using pnpm since some point (git ref, git tag or commit-sha) in your git history | ||
|
||
Internally uses [pnpm's filtering](https://pnpm.io/filtering) capabilities | ||
|
||
## Usage | ||
|
||
```yaml | ||
.... | ||
steps: | ||
# setup your node and pnpm | ||
.... | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get changed packages | ||
uses: akshay5995/cambios@v1.0.0 | ||
id: changed-package-action | ||
with: | ||
package-name: "" # Optional | ||
since: "" # Optional defaults to "origin/main" | ||
- name: echo changed packages | ||
run: echo ${{ steps.changed-package-action.outputs.changed-packages }} | ||
- name: echo CHANGE_DETECTED env | ||
run: echo ${{ env.CHANGE_DETECTED }} | ||
``` | ||
|
||
## Inputs | ||
|
||
Name in your `package.json` for the package that you want to detect change for: | ||
|
||
```yaml | ||
package-name: "" # Optional | ||
``` | ||
|
||
```yaml | ||
since: "" # Optional defaults to "origin/main" | ||
``` | ||
|
||
## Outputs | ||
|
||
Environment variable: | ||
|
||
```yaml | ||
CHANGE_DETECTED | ||
``` | ||
|
||
Can be used in following steps: | ||
|
||
```yaml | ||
steps: | ||
.... | ||
- name: Get changed packages | ||
uses: akshay5995/cambios@v1.0.0 | ||
- name: Run tests if only package has changed | ||
if: ${{ env.CHANGE_DETECTED }} | ||
run: pnpm test:ci | ||
``` | ||
|
||
Output: | ||
|
||
```yaml | ||
changed-packages | ||
``` | ||
|
||
Can be used in following steps: (useful in a monorepo that uses [pnpm workspaces](https://pnpm.io/workspaces)) | ||
|
||
```yaml | ||
steps: | ||
.... | ||
- name: Get changed packages | ||
uses: akshay5995/cambios@v1.0.0 | ||
id: changed-package-action | ||
- name: Echo all changed packages in the repo | ||
run: echo ${{ steps.changed-package-action.outputs.changed-packages }} | ||
``` | ||
|
||
Outputs stringified Json array for changed packages e.g, "["cambios"]" |
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,17 @@ | ||
name: "Cambios" | ||
description: "Github action to detect if there are any changes in pnpm workspace or repository using pnpm since some point (git ref, git tag or commit-sha) in your git history" | ||
inputs: | ||
package-name: | ||
description: "Package name in your package.json of the package you want to filter" | ||
required: false | ||
default: "" | ||
since: | ||
description: "Change since some reference from your git history e.g, git tag, git ref or commit-sha" | ||
required: false | ||
default: "origin/main" | ||
outputs: | ||
changed-packages: | ||
description: "List of package names that have changed" | ||
runs: | ||
using: "node16" | ||
main: "dist/index.js" |
Oops, something went wrong.