Skip to content

Helper for GitHub Actions to get config from the repository where the action is running.

License

Notifications You must be signed in to change notification settings

technote-space/github-action-config-helper

Repository files navigation

GitHub Action Config Helper

npm version CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

Helper for GitHub Actions to get config from the repository where the action is running.

Table of Contents

Details

Usage

  1. Install
    npm i @technote-space/github-action-config-helper
import { getConfig } from '@technote-space/github-action-config-helper';
import { getInput } from '@actions/core';
import { context, GitHub } from '@actions/github';

...

const config = await getConfig('config.yml', new GitHub(getInput('GITHUB_TOKEN', {required: true})), context);
//const config = await getConfig('config.json', new GitHub(getInput('GITHUB_TOKEN', {required: true})), context, {ref: 'feature/change'}); // branch
//const config = await getConfig('config', new GitHub(getInput('GITHUB_TOKEN', {required: true})), context, {ref: 'v1.2.3'}); // tag
//const config = await getConfig('config.yml', new GitHub(getInput('GITHUB_TOKEN', {required: true})), context, {configPath: ''}); // default: '.github'

Supported file types

YAML

  • .yml
  • .yaml

JSON

Other extensions

e.g.

  • config.json
  • .eslintrc

Author

GitHub (Technote)
Blog

About

Helper for GitHub Actions to get config from the repository where the action is running.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors 3

  •  
  •  
  •