7

I have a working Github Action file that build on commits.

I want to be able to manually trigger a build so I only added "workflow_dispatch" and got the nice option button visible in the GUI where I can select which branch to manually build.

But when I select a branch ("dev") and start the build it always get skipped?!

The yml-file is both in my "main" branch and in the desired branch "dev"

My yml-file looks like below and "workflow_dispatch" is the only thing I have changed:

name: Build for dev on: workflow_dispatch: push: branches: - dev pull_request: types: [opened, synchronize, reopened, closed] branches: - dev jobs: build_and_deploy_job: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and Deploy Job steps: - uses: actions/checkout@v2 with: submodules: true - name: Build And Deploy id: builddeploy uses: Azure/[email protected] with: app_build_command: "npm run build-dev" azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_XXXXX }} repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) action: "upload" ###### Repository/Build Configurations - These values can be configured to match you app requirements. ###### # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig app_location: "/" # App source code path api_location: "api" # Api source code path - optional output_location: "dist" # Built app content directory - optional ###### End of Repository/Build Configurations ###### env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} close_pull_request_job: if: github.event_name == 'pull_request' && github.event.action == 'closed' runs-on: ubuntu-latest name: Close Pull Request Job steps: - name: Close Pull Request id: closepullrequest uses: Azure/[email protected] with: azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_XXXXX }} action: "close" 

Does anyone know why build is being skipped, or where I can see the reason for it?

UPDATE: Screenshot from skipped build: enter image description here

UPDATED! I found solution myself! I had an if statement in "build_and_deploy_job" so I needed to change it to:

if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') 
4
  • Could you please attach the link to the log of the action execution? It would help determining the problem. Commented Aug 31, 2021 at 9:03
  • Repo is private, still there is no log produced - it just say build is skipped. Commented Aug 31, 2021 at 9:10
  • Can you add your full workflow? Commented Aug 31, 2021 at 9:51
  • I haave just updated this issue now with full yml-file content Commented Aug 31, 2021 at 10:38

1 Answer 1

7

I had the same symptom -- my manually run workflow was being marked as "Skipped."

In my case, I had the following condition on each job. This condition only ran the job if the previous workflow in the chain was successful:

if: ${{ github.event.workflow_run.conclusion == 'success' }} 

The above was not satisfied when the workflow was started manually. The following worked for me:

if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} 

The above says, "run this job if it was manually started or the parent workflow succeeded."

Sign up to request clarification or add additional context in comments.

1 Comment

I had a similar issue in my case with a check for the repo: if: github.repository == 'bgizdov/wrong-repo'

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.