Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .commitlintrc.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc.yml

This file was deleted.

33 changes: 26 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Test typescript-action"
name: 'Test typescript-action'
on:
pull_request:
push:
Expand All @@ -9,28 +9,47 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
# Checkout source
- name: Checkout source
uses: actions/checkout@v4.1.1
- name: Install Node (v20)
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0

# Setup Node with npm cache
- name: Setup Node with npm cache
id: node-install
uses: actions/setup-node@v4.0.2
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 #v5.0.0
with:
node-version: 20.11
node-version-file: '.nvmrc'
cache: 'npm'

# allow packages inside this repo to consume from our private npm registry
- name: Authenticate against NPM
run: |
npm config set //npm.pkg.github.com/:_authToken=$GH_TOKEN
npm config list
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_PKG_REGISTRY_READ }}

# Install dependencies
- name: Install dependencies
run: HUSKY=0 npm ci
run: npm ci
env:
HUSKY: 0

# Check code formatting
- name: 'Check code formatting'
run: npm run format:ci

# Check code linting
- name: 'Check code linting'
run: npm run lint:ci

# Build
- name: Build
run: npm run build

- name: Check for Execution
uses: ./
with:
skipOnCommitMsg: "sample"
skipOnCommitMsg: 'sample'
- name: Some Job
run: echo "sample"
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npx lint-staged && npm run build && git add dist/*
#!/bin/sh
npx lint-staged && npm run build && git add dist/*
16 changes: 0 additions & 16 deletions .lintstagedrc.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@shiftcode:registry=https://npm.pkg.github.com
@shiftcode:registry=https://npm.pkg.github.com
fund=false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.11.1
24
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
5 changes: 0 additions & 5 deletions .prettierrc.yml

This file was deleted.

43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@ This action accepts an input string `skipOnCommitMsg` which will be used to chec
If yes the output `shouldExecute` will be set to `false`. `true` otherwise. For full input / output list and other configurations check [`action.yml`](./action.yml).

## Example GitHub Workflow definition
This example shows how to setup two dependant jobs, the second will only be executed if the output from `checkExecution` job is `false`.

This example shows how to set up two dependant jobs, the second will only be executed if the output from `checkExecution` job is `true`.

```yaml
# jobs
checkExecution:
runs-on: ubuntu-latest
outputs:
shouldExecute: ${{ steps.stepCheckExecution.outputs.shouldExecute }}
steps:
- id: stepCheckExecution
name: Check for execution
uses: shiftcode/github-action-skip@releases/v2-alpha.0
with:
skipOnCommitMsg: "[skip_build]"
githubToken: ${{secrets.GH_TOKEN_3}}
runs-on: ubuntu-latest
outputs:
shouldExecute: ${{ steps.stepCheckExecution.outputs.shouldExecute }}
steps:
- id: stepCheckExecution
name: Check for execution
uses: shiftcode/github-action-skip@releases/v2-alpha.0
with:
skipOnCommitMsg: '[skip_build]'
githubToken: ${{secrets.GH_TOKEN_3}}
build:
runs-on: ubuntu-latest
needs: checkExecution
# only execute if not skipped by commit message
if: needs.checkExecution.outputs.shouldExecute == 'true'
steps: ...
runs-on: ubuntu-latest
needs: checkExecution
# only execute if not skipped by commit message
if: needs.checkExecution.outputs.shouldExecute == 'true'
steps: ...
```

## Development

### new version
1) implement your changes
2) commit changes (pre-commit hook will do some code checks / changes and build the artifacts using ncc)
3) set tag `git tag -a -m "my fancy release" v0.0.X`
4) push with tags `git push --follow-tags`

1. implement your changes
2. commit changes (pre-commit hook will do some code checks / changes and build the artifacts)
3. set tag `git tag -a -m "my fancy release" v0.0.X`
4. push with tags `git push --follow-tags`
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ outputs:
shouldExecute:
description: 'boolean value. True if the commit message contains the string provided in skipOnCommitMsg input param, false otherwise.'
runs:
using: 'node20'
using: 'node24'
main: 'dist/index.js'
9 changes: 9 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @see https://commitlint.js.org/reference/configuration.html
* @type { import('@commitlint/types').UserConfig }
*/
const config = {
extends: ['@commitlint/config-conventional'],
}

export default config
Loading