Coder Social home page Coder Social logo

proactionhq / proaction Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 2.0 233 KB

Proaction is a CLI to create better GitHub Action Workflows

Home Page: https://proaction.io

License: Apache License 2.0

Makefile 2.77% Go 86.96% Dockerfile 0.52% Open Policy Agent 9.74%
actions github-action reproducible-builds best-practices workflows proaction-checks

proaction's People

Contributors

github-actions[bot] avatar marccampbell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

proaction's Issues

Unstable GitHub Ref check should not update

If a workflow is found using a branch and the unstable-github-ref is producing a recommendation, it should attempt to find a tag or commit that matches the current ref to minimize the chance of breaking

Recommend updating to new tags

Currently the outdated check recommends a SHA -> SHA upgrade. But what about "stable" tags? i.e. why doesn't the github.com/actions/checkout@v1 recommend updating to github.com/actions/checkout@v2?

To do this, we can't simply look at commit dates, we need to semantically sort the tags. Because GitHub recommends (and most follow) using semver here, this should be reasonably easy.

Proposal: concurrent checks running on workflow

Instead of running all checks sequentially (part of the issue in #23), the CLI could show all of the actions and each check that needs to run, with a spinner on each, indicating what's happening and what's still running...

job: build-proaction
  step: actions/setup-go@v1
    outdated-action:    ✓
    unstable-github-ref: ✓

each step should complete before moving to the next, replacing the content on the screen with the next step.

Rename "unstable github ref" check

What's a better name for this check? The check name should be short and clear, meaning the opposite of immutable.

Some ideas:

  • inconsistent-github-ref
  • altered-github-ref

Implement the stable tag confirmation

There are a few TODOs in the code where a tag is checked against a known set of stable/unstable tags. We should finish this so that we don't recommend moving away from stable good tags, but instead only known unstable tags.

What's the difference between --diff and --dry-run

They have different description, but both sound like they'd do the same thing:

      --diff            when set, instead of writing the file, just show a diff
      --dry-run         when set, proaction will print the output and recommended changes, but will not make changes to the file

Create a GitHub Action

Proaction should be a GitHub action that can be executed in a workflow to update other workflows.

Rearchitect checks to be policy, not code

Currently, the implemented checks are all Go code in the pkg/checks directory.
This proposal is a WIP design to reimplement these as policy.

Motivation

  • Policy files can be loaded and configured at runtime, allowing for use cases that are not implemented specifically in the code
  • When running many policies or many workflow checks, Proaction will likely need to check the same data from the GitHub API multiple times. Policies would eliminate this because they execute offline.
  • Policies would be able to cache some inputs, lowering the number of requests made to the GitHub API

Implementation

There are several popular Policy engines available to consider:

  • OpenPolicyAgent
  • HashiCorp Sentinel

Workflow

The policy approach would be to design a single input, and allow each check to be defined in a runtime loaded policy document.

Input

The input for a workflow must contain all of the data necessary to evaluate the policy. This is simple for some data, but many policies rely on the GitHub API to get the current state of the Action to aid evaluation.

In these, a defined set of data will be statically assumed and provided to the check as input to the policy.

Additionally, each check should define the data to include, and a process will deduplicate the data thats needed before any is collected. This is done to minimize the number of GitHub API requests made and to improve the execution time of the checks when they don’t need all data.

Recommendations and outdated conflict

When an action is using the latest tag that is not listed in the recommendations, proaction remediates to the recommendation.

When an action is using the recommended tag but not the latest, proaction remediates to the latest.

Recommendations should always take priority.

Error when running `proaction version`

$ proaction version
Proaction 0.1.0

Unable to check for newer releases: find latest release: Get https://oss.proaction.io/version/install?version: dial tcp: lookup oss.proaction.io on 192.168.155.1:53: no such host

This is the endpoint that it can check for the latest version. We can either implement this endpoint or replace this with a call to the GitHub API for the latest version

Unable to run Proaction against own workflow

Cloning the repo and running

make proaction
./bin/proaction scan --diff .github/workflows/build-test-deploy.yaml 

Produces:

 ⠋ Scanning workflow fileError: failed to scan workflow: failed to run unstable outdated-action check: failed to execute outdated action check: failed to get ref type: failed to get commit ref: GET https://api.github.com/repos/actions/setup-go/commits/v1.1.2.1.2: 422 No commit found for SHA: v1.1.2.1.2 []

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.