You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@technote-space/filter-github-action

Package Overview
Dependencies
Maintainers
1
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@technote-space/filter-github-action

Helper to filter GitHub Action.

0.6.13
latest
Source
npm
Version published
Maintainers
1
Created
Source

Filter GitHub Action

npm version CI Status codecov CodeFactor License: MIT

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

Helper to filter GitHub Actions.

Table of Contents

Details

Usage

  • Install
    npm i @technote-space/filter-github-action
import { Context } from '@actions/github/lib/context';
import { context } from '@actions/github';
import { isTargetEvent, isTargetLabels } from '@technote-space/filter-github-action';

console.log( isTargetEvent( {
	'release': [
		// or
		'published',
		'rerequested',
	],
	'push': [
		// use context
		(context: Context): boolean => /^refs\/tags\//.test(context.ref),
		'rerequested',
	],
	'pull_request': [
		// or
		[
			// and
			(context: Context): boolean => /^refs\/tags\//.test(context.ref),
			'rerequested',
		],
	],
	// wildcard
	'project_card': '*',
}, context ) );

const includes = ['label1', 'label2'];
const excludes = ['label3', 'label4'];
console.log( isTargetLabels( includes, excludes, context ) );

Results from the above example

isTargetEvent
eventNameactionrefresult
releasepublished*true
releasererequested*true
releasecreated*false
push*refs/tags/v1.2.3true
push*refs/heads/v1.2.3false
pushrerequested*true
pull_requestrerequestedrefs/tags/v1.2.3true
pull_requestcreatedrefs/tags/v1.2.3false
pull_requestrerequestedrefs/heads/v1.2.3false
project_card**true
label**false
isTargetLabels
eventNamecontext labelsincludesexcludesresult
issues---------true
pull_request---------true
push---------true
issueslabel1------true
issues---label1---false
issueslabel1label1---true
issueslabel1, label2label1---true
issueslabel1label1, label2---true
issues------label1true
issueslabel1---label1false
issueslabel1, label2label1label2false
issueslabel1, label2label1label3true

Ignore check

with:
  IGNORE_CONTEXT_CHECK: 1

Author

GitHub (Technote)
Blog

Keywords

github

FAQs

Package last updated on 27 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts