Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move computesha256 to typescript #546

Merged
Merged
Show file tree
Hide file tree
Changes from 9 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
99 changes: 99 additions & 0 deletions .github/actions/compute-sha256/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
3 changes: 3 additions & 0 deletions .github/actions/compute-sha256/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
13 changes: 13 additions & 0 deletions .github/actions/compute-sha256/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Compute SHA256

## How to build this action in development
- Install node
- Install typescript
- `npm ci`
- `npm run all`

## Compare the dist/index.js with the actual source
This is to ensure that the source is correct.
- `git diff --ignore-space-at-eol dist diff`. In this case the prdist/index.js is the Pull Request version.
naveensrinivasan marked this conversation as resolved.
Show resolved Hide resolved
- The diff should be empty

22 changes: 3 additions & 19 deletions .github/actions/compute-sha256/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ outputs:
value: "${{ steps.compute.outputs.sha256 }}"

runs:
using: "composite"
steps:
- name: Compute the sha256
id: compute
shell: bash
naveensrinivasan marked this conversation as resolved.
Show resolved Hide resolved
env:
UNTRUSTED_PATH: "${{ inputs.path }}"
run: |
set -euo pipefail

echo "Computing SHA256 for $UNTRUSTED_PATH"
if ! [[ -f "$UNTRUSTED_PATH" ]]; then
echo "File $UNTRUSTED_PATH not present"
exit 5
fi
digest=$(sha256sum "$UNTRUSTED_PATH" | awk '{print $1}')
echo "computed sha: $digest"

echo "::set-output name=sha256::$digest"
using: node16
main: 'dist/index.js'

Loading