Skip to content

Commit

Permalink
Merge pull request #42 from tj-actions/feature/switch-to-composite-ac…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
jackton1 authored Feb 9, 2022
2 parents faced72 + 7de3c84 commit 9d890a0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 31 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ jobs:
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
test-versions:
runs-on: ubuntu-latest
name: Test installing versions
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -47,8 +51,12 @@ jobs:
dir: './test-success'
version: '1.0.0'
test-success:
runs-on: ubuntu-latest
name: Test success depcheck
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -63,13 +71,15 @@ jobs:
echo "Invalid exit code returned from depcheck"
exit 1
test-failure:
runs-on: ubuntu-latest
name: Test failure depcheck
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
- name: depcheck
uses: ./
id: depcheck
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0

- name: Run auto-doc
uses: tj-actions/auto-doc@v1.2.13

- name: Run test
uses: tj-actions/remark@v2.3
Expand Down
12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
[![Update release version.](https://github.com/tj-actions/depcheck/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/depcheck/actions/workflows/sync-release-version.yml)
[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fdepcheck%26badge%3Dtrue)](https://github.com/search?o=desc\&q=tj-actions+depcheck+path%3A.github%2Fworkflows+language%3AYAML\&s=\&type=Code)

[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Mac OS](https://img.shields.io/badge/mac%20os-000000?logo=macos\&logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Windows](https://img.shields.io/badge/Windows-0078D6?logo=windows\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)

## depcheck

Analyze node project dependencies using [depcheck](https://github.com/depcheck/depcheck).
Expand Down Expand Up @@ -33,11 +37,7 @@ If you feel generous and want to show some extra appreciation:
## Inputs
| Input | type | required | default | description |
|:-------------:|:-----------:|:-------------:|:---------------------:|:-----------------------------:|
| `dir` | `string` | `false` | `.` | The directory to run [depcheck](https://github.com/depcheck/depcheck#readme) |
| `ignores` | `string` | `false` | | Packages to ignore |
| `version` | `string` | `false` | `1.3.1` | Version of [depcheck](https://github.com/depcheck/depcheck/tags) |
## Outputs
## Features
Expand Down
24 changes: 18 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Run depcheck
description: Analyze npm project dependencies.
author: tj-actions
inputs:
token:
description: 'GITHUB_TOKEN or a Repo scoped PAT'
required: true
default: ${{ github.token }}
dir:
description: 'Directory to perform depcheck'
required: false
Expand All @@ -19,9 +15,25 @@ inputs:
required: false
default: '1.3.1'

outputs:
exit_code:
description: 'depcheck exit code'
value: ${{ steps.depcheck.outputs.exit_code }}


runs:
using: 'docker'
image: 'Dockerfile'
using: 'composite'
steps:
- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
id: depcheck
shell: bash
env:
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_DIR: ${{ inputs.dir }}
INPUT_IGNORES: ${{ inputs.ignores }}
INPUT_VERSION: ${{ inputs.version }}
branding:
icon: check-square
color: white
5 changes: 2 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

set -eo pipefail

yarn global add depcheck@"${INPUT_VERSION}"
npm install -g "depcheck@${INPUT_VERSION}"

OUTPUT=$(depcheck --ignores="${INPUT_IGNORES}" "${INPUT_DIR}" 2>&1) && exit_status=$? || exit_status=$?
echo "$OUTPUT"
depcheck --ignores="${INPUT_IGNORES}" "${INPUT_DIR}" 2>&1 && exit_status=$? || exit_status=$?

echo "::set-output name=exit_code::$exit_status"

Expand Down

0 comments on commit 9d890a0

Please sign in to comment.