Skip to content

Git ref matrix action

Actions
GitHub Action to create a stringified build matrix for branches and tags
v0.1.13
Latest
Star (2)

Git ref matrix action

GitHub release GitHub marketplace

test-with test-disabled test-without

This composite action creates a stringified JSON list of git refs to be used as a build matrix.

▶️ Inputs

The following inputs can be used to alter the Docker tag name determination:

Input Type Required Default Description
repository_default_branch string No master Optionally to fetch x number of latest tags from repository's main branch to add to the build matrix.
branches string No `` Optionally specify a comma separated list of branches to add to the build matrix.
tags string No `` Optionally specify a comma separated list of tags to add to the build matrix.
num_latest_tags number No 0 Optionally add x number of latest git tags to the build matrix (requires repository_default_branch to point to your repository's main branch.
disable_refs string No 'false' Optionally force to disable all refs alltogether by returning an empty matrix. Values: '0', '1', 'false', 'true'
Note: This is a string value, not a boolean.

◀️ Outputs

Output Type Description
matrix string Stringified JSON build matrix. Example: ["master","v0.1.0"]
has_refs string String that tells if we have matrix refs or not. Example: 'true' or 'false'
Note: This is a string value, not a boolean.

💻 Usage

on: [push]

jobs:
  get-matrix:
    runs-on: ubuntu-latest
    name: Get matrix
    outputs:
      matrix_ref: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - name: Fetch matrix
        id: set-matrix
        uses: cytopia/git-ref-matrix-action@v0.1.0
        with:
          repository_default_branch: master
          branches: master
          tags: v0.1.0,v0.1.1

  build:
    needs: [get-matrix]
    runs-on: ubuntu-latest
    name: build
    strategy:
      fail-fast: false
      matrix:
        ref:
          - ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: ${{ matrix.refs }}
      - name: Show git
        run: |
          git log | head -20

❗ Keep up-to-date with GitHub Dependabot

Since Dependabot has native GitHub Actions support, to enable it on your GitHub repo all you need to do is add the .github/dependabot.yml file:

version: 2
updates:
  # Maintain dependencies for GitHub Actions
  - package-ecosystem: "github-actions"
    directory: "/"
    schedule:
      interval: "daily"

:octocat: cytopia GitHub Actions

Name Description
docker-tag-action Determines Docker tags based on git branch, commit or git tag
git-ref-matrix-action Create stringified JSON list of git refs to be used as a build matrix
shell-command-retry-action Retries shell commands to avoid failing pipelines due to network issues
upload-artifact-verify-action Upload artifact and verifies it by downloading it again
upload-artifact-retry-action Retries upload-artifact-verify-action
download-artifact-retry-action Download artifact with retry functionality

📄 License

MIT License

Copyright (c) 2022 cytopia

Git ref matrix action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

GitHub Action to create a stringified build matrix for branches and tags
v0.1.13
Latest

Git ref matrix action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.