Expand comments

This commit is contained in:
Nick Alteen
2023-11-27 23:30:45 -05:00
parent dad0344519
commit 8e320a85d3

View File

@@ -1,23 +1,19 @@
# In TypeScript actions, `dist/index.js` is a special file. When you reference # In TypeScript actions, `dist/` is a special directory. When you reference
# an action with `uses:`, `dist/index.js` is the code that will be run. For this # an action with the `uses:` property, `dist/index.js` is the code that will be
# project, the `dist/index.js` file is generated from other source files through # run. For this project, the `dist/index.js` file is transpiled from other
# the build process. We need to make sure that the checked-in `dist/index.js` # source files. This workflow ensures the `dist/` directory contains the
# file matches what is expected from the build. # expected transpiled code.
# #
# This workflow will fail if the checked-in `dist/index.js` file does not match # If this workflow is run from a feature branch, it will act as an additional CI
# what is expected from the build. # check and fail if the checked-in `dist/` directory does not match what is
name: Check dist/ # expected from the build.
name: Check Transpiled JavaScript
on: on:
push: push:
branches: branches:
- main - main
paths-ignore:
- '**.md'
pull_request: pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs: jobs:
check-dist: check-dist:
@@ -47,7 +43,8 @@ jobs:
id: build id: build
run: npm run bundle run: npm run bundle
- name: Compare Expected and Actual Directories # This will fail the workflow if the PR wasn't created by Dependabot.
- name: Compare Directories
id: diff id: diff
run: | run: |
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
@@ -56,10 +53,12 @@ jobs:
exit 1 exit 1
fi fi
# If index.js was different than expected, upload the expected version as # If `dist/` was different than expected, and this was not a Dependabot
# a workflow artifact. # PR, upload the expected version as a workflow artifact.
- uses: actions/upload-artifact@v3 - if: ${{ failure() && steps.diff.outcome == 'failure' }}
if: ${{ failure() && steps.diff.conclusion == 'failure' }} name: Upload Artifact
id: upload
uses: actions/upload-artifact@v3
with: with:
name: dist name: dist
path: dist/ path: dist/