mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 22:15:15 +00:00
This commit adds the `stale-theme-pr-closer` closer action. This action is used to close theme pull requests with an `invalid` label that has been stale for a given number of `STALE_DAYS`.
40 lines
832 B
JavaScript
40 lines
832 B
JavaScript
/**
|
|
* @file Contains helper functions used in the scripts.
|
|
*/
|
|
|
|
// Script variables.
|
|
const OWNER = "anuraghazra";
|
|
const REPO = "github-readme-stats";
|
|
|
|
/**
|
|
* Retrieve information about the repository that ran the action.
|
|
*
|
|
* @param {Object} context Action context.
|
|
* @returns {Object} Repository information.
|
|
*/
|
|
export const getRepoInfo = (ctx) => {
|
|
try {
|
|
return {
|
|
owner: ctx.repo.owner,
|
|
repo: ctx.repo.repo,
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
owner: OWNER,
|
|
repo: REPO,
|
|
};
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Retrieve github token and throw error if it is not found.
|
|
*
|
|
* @returns {string} Github token.
|
|
*/
|
|
export const getGithubToken = () => {
|
|
const token = core.getInput("github_token") || process.env.GITHUB_TOKEN;
|
|
if (!token) {
|
|
throw Error("Could not find github token");
|
|
}
|
|
return token;
|
|
};
|