1.1.24 • Published 11 months ago

github-actions-client v1.1.24

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

github-actions-client

Known Vulnerabilities Coverage lines

This library is a Wrapper library that uses Octokit in the background. Currently you can use it to create, update and delete repository secrets and repository variables. Workflow dispatch events can be triggered with it. Also workflows can be loaded, activated or deactivated.

Installation

npm

npm i github-actions-client 

yarn

yarn add github-actions-client

Usage

import { GithubActionsClient } from 'github-actions-client'

const github_username = 'username';
const github_repository = 'repository';

async function main(): Promise<void> {
  try {
    const ghc = new GithubActionsClient(github_username, github_repository);

    await ghc.CreateOrUpdateSecret('SecretName1', 'SecretValue1');
    await ghc.CreateOrUpdateSecret('SecretName2', 'SecretValue2');
    await ghc.CreateOrUpdateRepositoryVariable('VariableName1', 'eu-central-1');
    await ghc.CreateOrUpdateRepositoryVariable('VariableName2', '1');
   

    await ghc.TriggerWorkflow(/*wokflow name */ 'main', /* branch */ 'main');
  } catch (err: any) {
    throw err;
  }
}

main()
  .then()
  .catch((err) => {
    console.error(err.message);
  });

The GithubActionsClient constructor

constructor(
  github_username: string, 
  github_repository: string, 
  githubToken?: string, 
  apiVersion?: string) {...}

github_username -> Your github username.

github_repository -> Repository where the actions should be performed.

githubToken -> (optional) Your personal token. If not provided the environment variable GITHUB_TOKEN will be used.

api Version -> (optional) A specific API version. If not provided '2022-11-28' will be used . Project is tested with this version

Code Documentation

GithubActionsClient

1.1.24

11 months ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago