Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

hublo/workshop-ga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Workshop Github Actions

Overview of an action

Triggers

Manual trigger

on:
  workflow_dispatch:

Basic trigger on PR

on:
  pull_request:
    # Sequence of patterns matched against refs/heads
    branches:    
      - main

Sending input to Actions

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning' 
        type: choice
        options:
        - info
        - warning
        - debug 

See triggers documentations for more

⚠️ ⚠️ ⚠️ ⚠️ NOW DO SOME STUFF ⚠️ ⚠️ ⚠️ ⚠️

  • Please clone this repository and then create your own branch ws-myname
  • Then modify the simple my-first-action.yml to be able to run it on every push on your specific branch only.
  • Add an input to be able to pass the version that you want to trigger (a text input named version).

⚠️ ⚠️ ⚠️ ⚠️

Actions

Basic job definition

jobs:
  my_first_job:
    name: My first job
  my_second_job:
    name: My second job

Job Dependencies

jobs:
  job1:
  job2:
    needs: job1
  job3:
    needs: [job1, job2]

And now where the magic happens

- uses: actions/setup-node@v2
  with:
    node-version: '14'

⚠️ ⚠️ ⚠️ ⚠️ NOW DO SOME STUFF ⚠️ ⚠️ ⚠️ ⚠️

  • By reusing the workflow my-first-action.yml modify it to add two step, one for running a build and one for a run.
  • Check on a new github action that you can use to modify json file (JQ) and use it to update the package version version with the one you give as input.
  • Create two jobs, one for build, one for run with a dependency

If you have the time :

  • edit the my-scheduled-action.yml workflow to add a scheduled run on the other workflow

Help

To be able to do this you will need to check this specific things :

  • Workflow triggering :
    steps:
      - uses: ./.github/workflows/my-action
        with:
          username: ${{ inputs.username }}

Scheduled trigger :

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron:  '30 5,17 * * *'

NOTE: Scheduled workflow are only trigger for main, you will need two things to make it works on your branch:

  • Trigger your workflow on the main branch
  • specificly checkout your branch at the beginning of the pipeline if you want to execute it.

⚠️ ⚠️ ⚠️ ⚠️