MassInstallAction.jl

Quickly and easily install a GitHub Action on all repositories in a GitHub organization
Author julia-actions
Popularity
31 Stars
Updated Last
7 Months Ago
Started In
January 2020

MassInstallAction

Build Status Codecov

Install a GitHub Action workflow file in one or more repositories.

There are two key steps: (1) creating the workflow and (2) installing it, a.k.a, submitting it as pull request(s) to one or more packages.

Creating the workflow

Some workflows have convenient helpers:

julia> workflow = MassInstallAction.compat_helper()      # workflow for https://github.com/JuliaRegistries/CompatHelper.jl

julia> workflow = MassInstallAction.tag_bot()            # workflow for https://github.com/JuliaRegistries/TagBot

or you can create your own:

workflow = MassInstallAction.Workflow("MyWorkflow", "workflow_filename.yml" => read("/home/me/template_workflow_file.yml", String))

where you replace:

  • "/home/me/template_workflow_file.yml" with the path to the local file you've prepared with the desired contents of the workflow;
  • "workflow_filename.yml" with the name you want the file to have in the repositories' .github/workflows directory;
  • "MyWorkflow" with the name used to identify this workflow when Actions runs.

You can add multiple workflow files simultaneously or even delete files, see ?MassInstallAction.Workflow.

Installing the workflow: examples

Install a workflow on all repositories in your GitHub organization

First make sure that you have an environment variable named MY_GITHUB_TOKEN that contains a GitHub personal access token (see below), and then run the following code.

Replace MY_ORGANIZATION with the name of your GitHub organization.

Replace MY_USERNAME, ANOTHER_ORG_ADMIN, etc. with your username and the usernames of other administrators in your GitHub organization.

julia> using MassInstallAction

julia> workflow = MassInstallAction.compat_helper()

julia> MassInstallAction.install(workflow,
                                 "MY_ORGANIZATION";
                                 token = ENV["MY_GITHUB_TOKEN"],
                                 cc = ["MY_USERNAME", "ANOTHER_ORG_ADMIN"])

Install a workflow on all repositories in your personal GitHub account

First make sure that you have an environment variable named MY_GITHUB_TOKEN that contains a GitHub personal access token, and then run the following code.

Replace MY_USERNAME with your GitHub username.

julia> using MassInstallAction

julia> workflow = MassInstallAction.compat_helper()

julia> MassInstallAction.install(workflow,
                                 "MY_USERNAME";
                                 token = ENV["MY_GITHUB_TOKEN"],
                                 cc = ["MY_USERNAME"])

Interaction with GitHub.jl

This package uses and interacts with GitHub.jl. In addition to the options above, you can MassInstallAction.install(workflow, repo::GitHub.Repo) directly. This may be the easiest approach if you want to filter repositories based on specific criteria. See ?MassInstallAction.install for more information.

Generating GitHub personal access token

To generate the GitHub personal access token, follow the instructions from this official link.

You should give these access in your GitHub token:

  • repo access: image

  • workflow access: image

Used By Packages

No packages found.