mirror of
https://github.com/actions/attest-build-provenance.git
synced 2026-06-13 18:19:53 +00:00
Update check-dist.yml
This commit is contained in:
parent
08528b0d2d
commit
1ff46e0aea
90
.github/workflows/check-dist.yml
vendored
90
.github/workflows/check-dist.yml
vendored
@ -1,66 +1,24 @@
|
||||
# In TypeScript actions, `dist/` is a special directory. When you reference
|
||||
# an action with the `uses:` property, `dist/index.js` is the code that will be
|
||||
# run. For this project, the `dist/index.js` file is transpiled from other
|
||||
# source files. This workflow ensures the `dist/` directory contains the
|
||||
# expected transpiled code.
|
||||
#
|
||||
# If this workflow is run from a feature branch, it will act as an additional CI
|
||||
# check and fail if the checked-in `dist/` directory does not match what is
|
||||
# expected from the build.
|
||||
name: Check Transpiled JavaScript
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-dist:
|
||||
name: Check dist/
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .node-version
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
id: install
|
||||
run: npm ci
|
||||
|
||||
- name: Build dist/ Directory
|
||||
id: build
|
||||
run: npm run bundle
|
||||
|
||||
# This will fail the workflow if the PR wasn't created by Dependabot.
|
||||
- name: Compare Directories
|
||||
id: diff
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
git diff --ignore-space-at-eol --text dist/
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If `dist/` was different than expected, and this was not a Dependabot
|
||||
# PR, upload the expected version as a workflow artifact.
|
||||
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
|
||||
name: Upload Artifact
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v4.0.2
|
||||
with:
|
||||
# Set always-auth in npmrc.
|
||||
always-auth: # optional, default is false
|
||||
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
|
||||
node-version: # optional
|
||||
# File containing the version Spec of the version to use. Examples: package.json, .nvmrc, .node-version, .tool-versions.
|
||||
node-version-file: # optional
|
||||
# Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.
|
||||
architecture: # optional
|
||||
# Set this option if you want the action to check for the latest available version that satisfies the version spec.
|
||||
check-latest: # optional
|
||||
# Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
|
||||
registry-url: # optional
|
||||
# Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
|
||||
scope: # optional
|
||||
# Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
||||
token: # optional, default is ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||
# Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.
|
||||
cache: # optional
|
||||
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.
|
||||
cache-dependency-path: # optional
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user