Skip to content

Commit

Permalink
Section 9 using outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
moontrip committed Jul 28, 2024
1 parent 00417ea commit 0aac883
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/actions/cached-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ inputs:
description: 'Whether to cache dependencies or not.'
required: false
default: 'true'
# DKDK check steps output
outputs:
used-cached:
description: 'Whether the cache was used'
value: ${{ steps.install.outputs.cache }}
runs:
# DKDK custom composite action
using: 'composite'
Expand All @@ -18,7 +23,10 @@ runs:
path: node_modules
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
id: install
if: steps.cache.outputs.cache-hit != 'true' && inputs.caching != 'true'
run: npm ci
run: |
npm ci
echo "cache='${{ inputs.caching }}" >> $GITHUB_OUTPUT
# DKDK shell: bash is required for custom composite action
shell: bash
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ jobs:
# run: npm ci
# DKDK use custom composite action
- name: Load & cache dependencies
id: cache-deps
# DKDK no need to indicate file (action.yml)
uses: ./.github/actions/cached-deps
with:
caching: 'false'
# DKDK check outputs defined at action.yml
- name: Output information
run: echo "Cache used? $${{ steps.cache-deps.outputs.used-cache }}"
- name: Lint code
run: npm run lint
test:
Expand Down

0 comments on commit 0aac883

Please sign in to comment.