Reputation: 7980
I'm writing a GitHub action to build protocol buffers code and push it to another repository after building:
name: Release Go
on:
push:
branches: [ "main" ]
workflow_dispatch:
env:
GEN_OUT_DIR: ./gopb
GEN_PROTO_DIR: ./protos
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.3
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install protoc-gen-go
run: |
go install github.com/golang/protobuf/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- name: Generate Go
run: |
mkdir -p $GEN_OUT_DIR
echo "Compiling..." && find $GEN_PROTO_DIR -type f -name "*.proto" -exec protoc --go_out=$GEN_OUT_DIR --go-grpc_out=$GEN_OUT_DIR {} \;
echo "Add Omitempty..." && find $GEN_OUT_DIR -type f -print0 | xargs -0 sed -i -e 's/,omitempty.*enable-default/"` /g'
- name: Release Go
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.GO_SSH_DEPLOY_KEY }}
with:
source-directory: ${{ env.GET_OUT_DIR }}
destination-github-username: 'my_user'
destination-repository-name: 'my_repo'
target-branch: main
This relies on github-action-push-to-another-repository action. The issue I'm having is that this action fails because source-directory
is empty. However, I'm injecting the value from the environment variable and it works in other places. How can I inject the value of an environment variable into the with
clause for another action?
Upvotes: 1
Views: 260
Reputation: 1324248
Check first if this is a typo issue.
You inject GEN_OUT_DIR
, but are using GET_OUT_DIR
which would be empty.
env:
GEN_OUT_DIR: ./gopb
Upvotes: 1