Skip to content
tag

GitHub Action

github-release-matrix-action

v1.1 Latest version

github-release-matrix-action

tag

github-release-matrix-action

GitHub Action to generate matrix from GitHub's repository releases via GitHub API

Installation

Copy and paste the following snippet into your .yml file.

              

- name: github-release-matrix-action

uses: actions-matrix/github-release-matrix-action@v1.1

Learn more about this action in actions-matrix/github-release-matrix-action

Choose a version

About

GitHub Action to generate matrix from GitHub's repository releases via GitHub API.

Usage

You can now consume the action by referencing the v1 branch

on:
  push:
    branches: [ main ]

jobs:
  generate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - id: releases
        uses: actions-matrix/github-release-matrix-action@main
        with:
          repository: "prometheus/alertmanager"
        env:
          GH_TOKEN: ${{ github.token }}
    outputs:
      matrix: ${{ steps.releases.outputs.matrix }}

  matrix:
    runs-on: ubuntu-latest
    needs: generate
    strategy:
      matrix: ${{ fromJson(needs.generate.outputs.matrix) }}
    steps:
      - run: |
          echo "tag_name=${{ matrix.releases.tag_name }}"
          echo "target_commitish=${{ matrix.releases.target_commitish }}"
          echo "author=${{ matrix.releases.author }}"

Example screenshot

Screenshot 2024-04-30 at 8 39 46 in the evening

Inputs

  • repository: Repository owner/name (e.g. "octocat/Hello-World")'
  • release: Release filter (e.g. "latest", ""). (Default: "")'
  • prerelease: Include prerelease releases. (Default: false)'
  • prefix: Remove version prefix from release tag name. (Default: false)'
  • limit: Limit the number of releases to fetch. (Default: 3)'

Outputs

  • matrix: JSON string with the matrix of releases.

Example

{
  "releases": [
    {
      "tag_name": "v1.16.2",
      "target_commitish": "c6e4c2d4dc3b0d57791881b087c026e2f75a87cb",
      "author": "hc-github-team-es-release-engineering",
      "created_at": "2024-04-22T20:25:54Z",
      "published_at": "2024-04-23T21:51:34Z"
    }
  ]
}

License

Licensed under the MIT License.