-
Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Misc Discussion Detailsname: Continuous Deployment Workflow This workflow is triggered whenever commits are pushed to the main branchon: permissions: jobs: deploy_fixed_staging: Whenever there is a push to main I get error - But this works when workflow_dispatch is used. I know this format isnt correct but am not getting whats wrong here. I need serious help in this. There is no flaw in the reusable workflow since I am using it in another workflow as well but thats through workflow_dispatch. Please help me! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
|
Your error happens because you’re mixing a normal job and a reusable workflow job. If you use on:
workflow_call:…and the caller job must not have Example caller workflow ( on:
push:
branches: ['main']
jobs:
deploy_fixed_staging:
uses: bLACKZU/npm-ci-cd-actions/.github/workflows/called-deploy.yaml@main
with:
PR_number: main
src_path: ./web
remote_path: /var/app
remote_host: ${{ vars.STAGING_HOST }}
remote_user: ubuntu
secrets:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}Example called workflow ( on:
workflow_call:
inputs:
PR_number:
required: true
type: string
src_path:
required: true
type: string
remote_path:
required: true
type: string
remote_host:
required: true
type: string
remote_user:
required: true
type: string
secrets:
SSH_PRIVATE_KEY:
required: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Example step
run: echo "Deploying..."Once you add |
Beta Was this translation helpful? Give feedback.
-
|
Based on the discussion details provided, the GitHub Actions topic or product is Continuous Deployment (CD). Here's why: The workflow's name, "Continuous Deployment Workflow," explicitly states the purpose. The trigger, "whenever commits are pushed to the main branch," is a classic and fundamental event for continuous deployment. A continuous deployment pipeline automatically deploys code to a production environment every time a new change is merged into the main branch, often after a series of automated tests. Continuous Deployment with GitHub Actions This video is a tutorial that explains continuous deployment and how to implement it using GitHub Actions, which is directly relevant to the topic. |
Beta Was this translation helpful? Give feedback.

Your
called-deploy.yamlis already correct — it hason: workflow_callwith all the expectedinputsandsecrets.The error you’re seeing is most likely coming from the caller workflow syntax.
When calling a reusable workflow with
uses:, the job must follow this structure:Important rules for caller workflows:
runs-onin a job that usesuses:.name:orenvironment:…