/validate-workflow-status

Primary LanguageC#BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Validate Workflow Status (Github Action)

CI CD Coverage Reliability Rating Security Rating

A Github Action that validates another workflow's status. For instance, validating build/test workflow before a workflow to create a release. See change log for all the release notes.

Usage

Prerequisites

  • Create a workflow .yml file in your repositories .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
  • Another workflow already in use to reference for the workflow containing the Validate Workflow Status step.

Inputs

  • token: Your Github API token. Recommended to use ${{ secrets.GITHUB_TOKEN }}
  • workflow: The name of the workflow to validate against. Must be in the same project.
  • branch: The branch name to check and validate the status against. Defaults to main.
  • status: The string value of the workflow status to match against. Defaults to success.

Outputs

  • none

Example workflow - create a release

On every push to a tag matching the pattern v*, create a release by validating another build is successful. This Workflow example assumes you'll use the @actions/create-release action to create the release step:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
    - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Validate Release
        uses: xembly/validate-workflow-status@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}  # This token is provided by Github Actions, you do not need to create your own token
          workflow: build
          branch: main     #optional
          status: success  # optional
      # @actions/create-release step...

License

Licensed under the terms of the BSD-3-Clause License