How to use Github Actions to generate a checksum and set env variable?

mattrzr

Would like to generate a checksum via Github Actions and set to env variable CHECKSUM like so:

     - name: Create checksum
       run: echo CHECKSUM=$(shasum -a 1 foo.zip | awk '{ print $1 }') >> $CHECKSUM

but it returns an error:

/home/runner/work/_temp/b6f2fd2a-359b-4052-a439-4f5b0a629a85.sh: line 1: $CHECKSUM: ambiguous redirect
Benjamin W.

Setting environment variables works differently: you append to a file whose name is stored in the $GITHUB_ENV variable, i.e., something like

run: |
  echo CHECKSUM="$(shasum foo.zip | awk '{ print $1 }')" >> "$GITHUB_ENV"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I set an env var with a bash expression in GitHub Actions?

How do I use Docker with GitHub Actions?

How to generate barcode checksum

How to set secrets in Github Actions?

GitHub Actions - empty env secrets

How to set the docker user in Github Actions

Github Actions: How use strategy/matrix with script

How do I use an env file with GitHub Actions?

GitHub Actions: env: Use pre-defined environment variables on RHS within env section

how to use variables in "with" block in github actions

GitHub Actions If contains function not working with env.VARIABLE

Github Actions - How to use a variable defined in env in the same env section?

How to use mstest in github actions?

How to set up actions in GitHub for new user?

How to set and access a Workflow variable in GitHub Actions?

How do I use secrets in Github Actions?

How to set correct root path when use Github Actions ci/cd?

How to set env variable or use instant client library in AWS Lambda

How to configure / use AWS CLI in GitHub Actions?

PHP / Github Actions workflows: how to provide secrets in $_ENV

'set-env' error when trying to build Android app using GitHub Actions - don't understand how to use Environment Files in this circumstance

How to set Dockerfile tag in GitHub Actions?

How to use working-directory in GitHub actions?

How to redact a dynamic environment variable GitHub Actions?

How to use Terragrunt in Github Actions

Github Actions- expression function to set environment variable

GitHub Actions: How to conditionally set input variable of an action?

How to use GitHub Actions secrets in k8s Job env?

How to use pnpm instead of npm in Github Actions