Skip to content

Example repo demonstrating different types of automated tasks and CI integrations using GitHub Actions and Danger

Notifications You must be signed in to change notification settings

noriban/GitHubActionsAutomationSandbox

 
 

Repository files navigation

Nightly Build

Example repo demonstrating different types of automated tasks and CI integrations

Examples Included

  • Simple GitHub Actions workflow examples
  • ktlint running in CI
  • Gradle task to copy a pre-push git hook that validates ktlint
  • .gitignore file which allows code styles, scopes, templates, etc to be tracked
  • Pull Request template for GitHub
  • Bug Report & Feature Issue templates for GitHub
  • Danger integration to report APK size
  • Danger integration to warn if WIP
  • Danger integration to thank PR author
  • Danger integration to add inline ktlint issue comments
  • Danger integration to warn about missing PR description
  • GitHub Actions workflow to check for dependency updates every day at 8:00

Triggering Repository_Dispatch Workflows

Running the following curl command will trigger 2 different workflows:

  • triggered_example.yml
  • triggerable_tasks.yml
curl -H "Accept: application/vnd.github.everest-preview+json" \
    -H "Authorization: token <your-token-here>" \
    --request POST \
    --data '{"event_type": "do-something"}' \
    https://api.github.com/repos/n8ebel/GitHubActionsAutomationSandbox/dispatches

With this command, the triggerable_tasks.yml workflow will run, but several of the steps will not run because the repository_dispath event didn't have the required properties passed with it.

To run the full triggerable_tasks.yml workflow, run the following curl command:

curl -H "Accept: application/vnd.github.everest-preview+json" \
    -H "Authorization: token <your-token-here>" \
    --request POST \
    --data '{"event_type": "do-something", "client_payload": { "text": "a title"}}' \
    https://api.github.com/repos/n8ebel/GitHubActionsAutomationSandbox/dispatches

Triggering Workflow_Dispatch Events

Workflows configured to run in response to workflow_dispatch events may be triggered in 2 ways:

  • using the GitHub Actions api
  • from the GitHub Actions UI in your repository

To trigger the workflow_dispatch_example.yml workflow, the following curl can be used:

curl -H "Accept: application/vnd.github.everest-preview+json" \
    -H "Authorization: token <your-token-here>" \
    --request POST \
    --data '{
              "ref": "main",
              "inputs":{
                "input1":"some value",
                "input2":"some value 2"
              }
            }' \
    https://api.github.com/repos/n8ebel/GitHubActionsAutomationSandbox/actions/workflows/workflow_dispatch_example.yml/dispatches
  • The ref input corresponds to the branch, tag, or commit you want the workflow to be run on.
  • The inputs input corresponds with the inputs defined in the workflow file, and with what is present in the UI when triggering the workflow from GitHub

Resources

About

Example repo demonstrating different types of automated tasks and CI integrations using GitHub Actions and Danger

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 55.4%
  • Ruby 30.4%
  • Shell 14.2%