Code Monkey home page Code Monkey logo

parrot's Introduction

Manorrock Parrot - a GitHub Workflow Generator

build

Prerequisites

  1. Java 21

Cron

To set the cron schedule for a given workflow use

<!-- workflow.cron(* * * * *) -->

Direct only

To only run a snippet when it is in the original Markdown and not coming in through workflow.include use the following:

<!-- workflow.directOnly()

script commands

  -->

(Workflow) dispatch

To allow for triggering the workflow manually use the snippet below:

<!-- workflow.dispatch() -->

Include

To include content from another file one can use the following:

<!-- workflow.include(relativeFilename.md) -->

(Always) Run

To always run a specific set of comments one can use the following:

<!-- workflow.run()

script commands

  -->

Skip

To skip a snippet for inclusion use the following:

<!-- workflow.skip() -->

How do you generate GitHub workflows?

In the root directory of your GitHub repository the following invocation will generate the GitHub workflows into the .github/workflows directory.

 java -jar parrot.jar --baseDirectory . --outputDirectory .github/workflows

How do I contribute?

See Contributing

Our code of Conduct

See Code of Conduct

Important notice

Note if you file issues or answer questions on the issue tracker and/or issue pull requests you agree that those contributions will be owned by Manorrock.com and that Manorrock.com can use those contributions in any manner Manorrock.com so desires.

parrot's People

Contributors

mnriem avatar agoncal avatar

Stargazers

Mark Heckler avatar

Watchers

James Cloos avatar  avatar Kostas Georgiou avatar  avatar

Forkers

agoncal

parrot's Issues

Add a logger

@mnriem I am looking at introducing some tests. But before doing a bit of refactoring (changing a few private methods to package to testing is easier), I would like to add a logger instead of System.out.println. This way we can have INFO as well as DEBUG information.

Ok with using JUL instead of System.out.println ?

Generate a separate shell script

Today Parrot generates a workflow file which contains a set of shell commands:

      - uses: 'actions/checkout@v2'
      - run: | 
          
          if [[ -z $RESOURCE_GROUP ]]; then
          export RESOURCE_GROUP=java-on-azure-$RANDOM
          export REGION=westus2
          fi
          
          az group create --name $RESOURCE_GROUP --location $REGION
          az extension add -n kusto
...

It would be nice for Parrot to also generate a separate a shell script (at the root of the sample) with (roughly) the same content (eg. get rid of the $RANDOM variable):

#!/bin/bash
          
if [[ -z $RESOURCE_GROUP ]]; then
export RESOURCE_GROUP=java-on-azure
export REGION=westus2
fi
          
az group create --name $RESOURCE_GROUP --location $REGION
az extension add -n kusto
...

Add a warning comment in the workflow when a file to be included does not exist

ATM when we include a file that does not exist, there is no warning displayed. It would be nice to display a warning, but also to add a comment inside the workflow. This way, we could generated something like:

      - uses: 'actions/checkout@v2'
      - run: | 
          blah blah blah
          # WARN File could not be found: src/test/resources/dummy.md
          blah blah blah

It would just be a matter of checking if the file exists when processing the include snippet. Something like this:

    private void processIncludeSnippet(ParrotContext context, String includeFilename) {
        File includeFile = new File(context.getCurrentFile().getParent(), includeFilename);
        if (includeFile.exists()) {
            context.getSnippetStack().push(context.getSnippets());
            context.getFileStack().push(includeFile);
            System.out.println("Begin processing - " + includeFile.toPath().normalize());
            List snippets = loadFile(includeFile);
            context.setSnippets(snippets);
        } else {
            LOGGER.log(WARN, "File could not be found: " + includeFile.toPath().normalize());
            context.getScriptBuilder().append("# WARN File could not be found: " + includeFile.toPath().normalize());
            context.getScriptBuilder().append("\n");
        }
    }

Add includeOnce directive

When false it only includes the targeted include
When true it does a recursive include (default if not specified)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.