Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

devops-maturity-action

CI

A GitHub Action that automatically runs the devops-maturity CLI whenever devops-maturity.yml is updated, generates a new badge reflecting the current maturity level, and opens a pull request for team review.

Overview

When a team edits their devops-maturity.yml assessment file the action will:

  1. Install the devops-maturity CLI.
  2. Run dm config --file devops-maturity.yml to calculate the score and badge.
  3. Update the README.md badge in-place (or prepend one if none exists).
  4. Open (or update) a pull request containing the badge change for review.

Usage

Minimal setup

Add the following workflow file to your repository at .github/workflows/devops-maturity.yml:

name: DevOps Maturity Checkon:
push:
branches:
- mainpaths:
- 'devops-maturity.yml'workflow_dispatch:
jobs:
update-badges:
runs-on: ubuntu-latestpermissions:
contents: writepull-requests: writesteps:
- uses: actions/checkout@v4
- uses: devops-maturity/devops-maturity-action@v1with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Assessment file

Place a devops-maturity.yml file at the root of your repository. Use dm assess interactively to generate the initial file, or start from the template below:

# DevOps Maturity Assessment# https://devops-maturity.github.io/project_name: my-project# BasicsD101: true # Branch Builds (must have)D102: true # Pull Request Builds (must have)D103: false # Clean Build Environments (nice to have)# QualityD201: true # Unit Testing (must have)D202: false # Functional Testing (must have)# … (see devops-maturity.yml in this repo for the full list)

Inputs

InputRequiredDefaultDescription
github-tokenyesToken used to create the pull request. Pass ${{ secrets.GITHUB_TOKEN }}.
filenodevops-maturity.ymlPath to the assessment YAML file.
readme-pathnoREADME.mdPath to the README file to update with the badge.
pr-branchnochore/update-devops-maturity-badgesBranch name for the pull request.
commit-messagenochore: update devops-maturity badgesCommit message for the badge update.
pr-titlenochore: update devops-maturity badgesTitle of the pull request.
pr-bodyno(auto-generated)Body text of the pull request.
cli-versionno(latest)Pin a specific CLI version for reproducible results (e.g. 0.1.0).

Outputs

OutputDescription
scoreOverall maturity score as a percentage (e.g. "72.3%").
levelMaturity level: WIP, PASSING, BRONZE, SILVER, or GOLD.
badge-urlshields.io badge URL for the current maturity level.
badge-markdownReady-to-paste Markdown snippet for the badge.
pull-request-numberNumber of the created (or updated) pull request.
pull-request-urlHTML URL of the created (or updated) pull request.

Using outputs in subsequent steps

- id: maturityuses: devops-maturity/devops-maturity-action@v1with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Print resultsrun: | echo "Score : ${{ steps.maturity.outputs.score }}" echo "Level : ${{ steps.maturity.outputs.level }}" echo "PR : ${{ steps.maturity.outputs.pull-request-url }}"

Permissions

The workflow job must have the following permissions:

permissions:
contents: write # to push the badge-update branchpull-requests: write # to open the pull request

How the badge update works

The action searches the target README for an existing DevOps Maturity shields.io badge using a regular expression. If one is found it is replaced in-place; if none exists the new badge is prepended before the first Markdown heading (or at the very top of the file).

Reproducibility

For reproducible CI results, pin both the action and the CLI to specific versions:

- uses: devops-maturity/devops-maturity-action@v1with:
github-token: ${{ secrets.GITHUB_TOKEN }}cli-version: '0.1.0'# pin CLI version

License

Apache 2.0

About

Run devops-maturity CLI, update README badge, and open a PR for review.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors