How to use the @actions/github.event function in @actions/github

To help you get started, we’ve selected a few @actions/github examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lots0logs / gh-action-get-changed-files / main.js View on Github external
// External Dependencies
const fs = require('fs');
const gh = require('@actions/github');


const commits = gh.event.commits.filter(c => c.distinct);

const FILES          = [];
const FILES_MODIFIED = [];
const FILES_ADDED    = [];
const FILES_DELETED  = [];

commits.forEach(commit => {
	FILES.push(...commit.modified, ...commit.added);
	FILES_MODIFIED.push(...commit.modified);
	FILES_ADDED.push(...commit.added);
	FILES_DELETED.push(...commit.removed);
});

fs.writeFileSync(`${process.env.HOME}/files.json`, JSON.stringify(FILES), 'utf-8');
fs.writeFileSync(`${process.env.HOME}/files_modified.json`, JSON.stringify(FILES_MODIFIED), 'utf-8');
fs.writeFileSync(`${process.env.HOME}/files_added.json`, JSON.stringify(FILES_ADDED), 'utf-8');

@actions/github

Actions github lib

MIT
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis