Home > database >  Unable to Manually Trigger GitHub Action
Unable to Manually Trigger GitHub Action

Time:08-09

I recently started working on using some GitHub actions on my projects. I am able to setup them up to run automatically but am struggling with having them run manually. I know that you need the have the workflow_dispatch in the on section. I'm not sure if it's not working because I have it automatically run too. Is someone able to tell me what I am doing wrong?

Here is one of my workflow YAML files

name: Create-Doc-Nightly

on:  
  push:
    branches: [ "nightly" ]
    paths:
      - 'src/**'
      - 'pom.xml'
 
  workflow_dispatch:

jobs:
  doc:
    name: Create Doc
    runs-on: ubuntu-latest
    
    steps:
      - uses: actions/checkout@v3
        name: Step 1 - Checkout Nightly Branch
        with:
          persist-credentials: false
          fetch-depth: 0
      - name: Step 2 - Setup JDK 17
        uses: actions/[email protected]
        with: 
          java-version: 17
          distribution: 'temurin'
      - name: Step 3 - Remove Doc
        run: |
          git remote set-url origin https://jnstockley:${{ secrets.TOKEN }}@github.com/jnstockley/BTTN.git
          git config user.email "[email protected]"
          git config --local user.name "Jack Stockley"
          git rm -r docs
          git commit -m "Removed Docs"
          git push origin nightly
      - name: Step 4 - Create Doc
        run: mvn dokka:dokka -f pom.xml
      - name: Step 5 - Move Docs
        run: |
           rm -rf docs
           mkdir -p docs
           mv target/dokka/* docs
      - name: Step 6 - Publish docs
        run: |
          git remote set-url origin https://jnstockley:${{ secrets.TOKEN }}@github.com/jnstockley/BTTN.git
          git config user.email "[email protected]"
          git config --local user.name "Jack Stockley"
          git add -f docs
          git commit -m "Updated Docs"
          git push origin nightly

Link to GitHub repo, nightly branch: enter image description here

You might like the following documentation links

workflow_dispatch

github docs - events-that-trigger-workflows

  • Related