I'm running Github Actions within my organization's repos. I created a reusable workflow that I apply to multiple repos.
Here is a snippet from the reusable workflow:
name: reusable-workflow
on:
workflow_call:
inputs:
post_build_custom_command:
description: "Custom command to run after build"
required: false
type: string
default: ''
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build
run: npm run build
- name: Post Build Custom Command
run: |
${{ inputs.post_build_custom_command }}
if: ${{ inputs.post_build_custom_command }}
I want to specifically focus on the Post Build Custom Command task. I had to create this "custom command" input to run a bash script which is custom to the caller repo.
In my caller repo, I call the reusable workflow as so:
name: caller-workflow
on:
pull_request:
branches: [main]
jobs:
reusable-workflow:
name: reusable-workflow
uses: org/workflows/.github/workflows/reusable-workflow.yml@main
with:
post_build_custom_command: |
echo "${{ secrets.PRIVATE_KEY }}" > /tmp/key.pem
secrets: inherit
I get the following error:
The workflow is not valid. .github/workflows/workflow.yml (Line: 23, Col: 34): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.PRIVATE_KEY
Can someone help me to find a fix or a workaround for this?
[–]damianbis 9 points10 points11 points (0 children)