PR Changes Matrix Builder

Overview

PR Changes Matrix Builder

This Action will generate a output variable that can be used to generate a dynamic matrix job.

This is often need for repos that contain many apps, here are a few examples:

  • Terraform Infrastructure: At my current job we have a single repo with all of our cloud infrastructure. Each folder is deployed individually, so being able to detect what folders have been changed can build a matrix for each terraform plan command.

  • ArgoCD: This is a single repo with all of our ArgoCD apps. Each folder is deployed individually, so being able to detect what folders have been changed can build a matrix for each ArgoCD command.

  • Helm chart: At my current job we have a collection of generic helm charts. Each folder is a chart that is individually deployed, tagged, and released.

This action is based on a quick POC in KyleJamesWalker/action-playground PR#3 and expands on a command like:

# Github Command
$ gh pr view 3 --repo KyleJamesWalker/action-playground --json files --jq '.files.[].path' | cut -d "/" -f1 | grep -v '[\\|\.]' | sort | uniq | jq  --raw-input .

# Example Output
"example_1"
"example_2"

Docker Image Sizes

  • kylejameswalker/pr-changes-matrix-builder-pytest 308MB
  • kylejameswalker/pr-changes-matrix-builder 254MB
You might also like...
Automatically commits and pushes changes from a specified directory to remote repository

autopush a simple python program that checks a directory for updates and automatically commits any updated files (and optionally pushes them) installa

A simple script that loads and hot-reloads cogs when you save any changes

DiscordBot-HotReload A simple script that loads and hot-reloads cogs when you save any changes Usage @bot.event async def on_ready(): from HotRelo

Lambda-function - Python codes that allow notification of changes made to some services using the AWS Lambda Function
Lambda-function - Python codes that allow notification of changes made to some services using the AWS Lambda Function

AWS Lambda Function This repository contains python codes that allow notificatio

A Matrix-Instagram DM puppeting bridge

mautrix-instagram A Matrix-Instagram DM puppeting bridge. Documentation All setup and usage instructions are located on docs.mau.fi. Some quick links:

Matrix trivia bot with python

Matrix-trivia-bot Getting started See SETUP.md for how to setup and run the template project. Project structure A reference of each file included in t

An example of matrix addition, demonstrating the basic method of Python calling C library functions

Example for Python call C functions An example of matrix addition, demonstrating the basic method of Python calling C library functions. How to run Bu

The worst but simplest webhook bot for GitHub and Matrix.
The worst but simplest webhook bot for GitHub and Matrix.

gh-bot gh-bot is maybe the worst (but simplest) Matrix webhook bot for Github. Example of commits: Example of workflow finished: Setting up Server You

A template / demo bot for the Halcyon matrix bot library
A template / demo bot for the Halcyon matrix bot library

Halcyon stock bot Hello! This is an example / template bot using the halcyon matrix bot library. Feel free to ask questions in the matrix chat #halcyo

Companion "receiver" to matrix-appservice-webhooks for [matrix].

Matrix Webhook Receiver Companion "receiver" to matrix-appservice-webhooks for [matrix]. The purpose of this app is to listen for generic webhook mess

Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

Virtual Python Environment builder

virtualenv A tool for creating isolated virtual python environments. Installation Documentation Changelog Issues PyPI Github Code of Conduct Everyone

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.

PyPika - Python Query Builder Abstract What is PyPika? PyPika is a Python API for building SQL queries. The motivation behind PyPika is to provide a s

Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

sphinx builder that outputs markdown files.
sphinx builder that outputs markdown files.

sphinx-markdown-builder sphinx builder that outputs markdown files Please ★ this repo if you found it useful ★ ★ ★ If you want frontmatter support ple

gnosis safe tx builder

Ape Safe: Gnosis Safe tx builder Ape Safe allows you to iteratively build complex multi-step Gnosis Safe transactions and safely preview their side ef

A URL builder for genius :D

genius-url A URL builder for genius :D Usage from gurl import genius_url

Piccolo - A fast, user friendly ORM and query builder which supports asyncio.

A fast, user friendly ORM and query builder which supports asyncio.

This open-source python3 script is a builder to the very popular token logger that is on my github that many people use.
This open-source python3 script is a builder to the very popular token logger that is on my github that many people use.

Discord-Logger-Builder This open-source python3 script is a builder to the very popular token logger that is on my github that many people use. This i

Que es S4K Builder?, Fácil un constructor de tokens grabbers con muchas opciones, como BTC Miner, Clipper, shutdown PC, Y más! Disfrute el proyecto. 3

S4K Builder Este script Python 3 de código abierto es un constructor del muy popular registrador de tokens que está en [mi GitHub] (https://github.com

Comments
  • First Version

    First Version

    The following has been done:

    • Auth with gh cli
    • Pull changes from a PR with gh cli
    • Generate a matrix with hardcoded values
    • Explicitly include and ignore files
    • Hardcoded workflow to against a remote repo's PR
    • Tests with testing workflow

    Still needs the following:

    • Examples in the docs
    • Better optional inputs (all required right now, need tests to handle possible combinations)

    PRs will have the following tests:

    • A static reference to a known PR
    • A static reference to a known PR without any files changes (blank matrix)
    • A pytest run to add tests.

    image

    opened by KyleJamesWalker 0
  • Improve the Docs

    Improve the Docs

    I need to improve the docs, with a sample repo like the following:

    Folder structure:

    .
    ├── Makefile
    ├── README.md
    ├── example-1
    │   └── README.md
    └── example-2
        └── README.md
    

    Example workflow:

    name: Test PR
    
    on:
      pull_request:
        types: [edited, opened, synchronize, reopened]
        branches: [master]
    
    jobs:
    
      pr-changes:
        runs-on: ubuntu-latest
    
        outputs:
          matrix-params: ${{ steps.matrix-builder.outputs.matrix }}
          matrix-populated: ${{ steps.matrix-builder.outputs.matrix-populated }}
    
        steps:
          - name: PR Changes Matrix Builder
            uses: KyleJamesWalker/[email protected]
            id: matrix-builder
            with:
              inject_primary_key: project_name
              extract_re: '(?P<project_name>.*)/.*'
              # Only changes in folders, nothing in the root should be included
              paths_include: '["**/**"]'
              paths_ignore: '[".github/**"]'
    
      test-pr:
        needs: [pr-changes]
        if: needs.pr-changes.outputs.matrix-populated == 'true'
        runs-on: ubuntu-latest
    
        strategy:
          matrix:
            params: ${{ fromJson(needs.pr-changes.outputs.matrix-params ) }}
    
        steps:
          - uses: actions/checkout@v2
    
          - name: Test
            run: make test project_name=${{ matrix.params.project_name }}
    
    

    Example Makefile:

    protocol ?= unset
    
    test:
    	@echo Testing protocol = ${protocol}
    
    

    This will run make test protocl=xxx for each folder that has changes in it, but it will also ignore changes in the .github and root folers.

    opened by KyleJamesWalker 0
Releases(v0.0.1)
  • v0.0.1(Jan 20, 2022)

    What's Changed

    • First Version by @KyleJamesWalker in https://github.com/KyleJamesWalker/pr-changes-matrix-builder/pull/1

    New Contributors

    • @KyleJamesWalker made their first contribution in https://github.com/KyleJamesWalker/pr-changes-matrix-builder/pull/1

    Full Changelog: https://github.com/KyleJamesWalker/pr-changes-matrix-builder/commits/v0.0.1

    Source code(tar.gz)
    Source code(zip)
Owner
Kyle James Walker (he/him)
Kyle James Walker (he/him)
gnosis safe tx builder

Ape Safe: Gnosis Safe tx builder Ape Safe allows you to iteratively build complex multi-step Gnosis Safe transactions and safely preview their side ef

null 228 Dec 22, 2022
Changes the Telegram bio, profile picture, first and last name to the song that the user is currently listening to.

TGBIOFY - Telegram & Spotify integration Changes the Telegram bio, profile picture, first and last name to the song that the user is currently listeni

elpideus 26 Dec 7, 2022
Automatically detect changes made to the official Telegram sites.

?? Telegram Web Crawler This project is developed to automatically detect changes made to the official Telegram sites. This is necessary for anticipat

Il'ya 115 Dec 31, 2022
Changes your desktop wallpaper based on the weather.

WallPaperChanger ??️ Description ⛈️ This Python script changes your desktop wallpaper based on the weather. Cloning ?? $ git clone https://github.com/

Clarence Yang 74 Nov 29, 2022
A python script that changes our background based on current weather and time of the day.

Desktop background on Windows 10, based on current weather and time A python script that changes our background based on current weather and time of t

Maj Gaberšček 1 Nov 16, 2021
Get informed when your DeFI Earn CRO Validator is jailed or changes the commission rate.

CRO-DeFi-Warner Intro CRO-DeFi-Warner can be used to notify you when a validator changes the commission rate or gets jailed. It can also notify you wh

null 5 May 16, 2022
Automatically changes your discord status

Automatically changes your discord status, Be careful as this may get you rate limited and banned

octo 5 Sep 20, 2022
This script will detect changes in your session using Discords built in Gateway.

Detect Session Gateway This script will detect changes in your session using Discords built in Gateway. What does this log? Discord build version Oper

Omega 5 Dec 18, 2021
Due to changes to the discord API and discord.py being discontinued

Talia Due to changes to the discord API and discord.py being discontinued, Talia development has been halted permanently A customizable economy discor

null 2 Mar 8, 2022