ci: add stale theme pull request closer action push (#2067)

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`.
This commit is contained in:
Rick Staa
2022-10-02 11:05:13 +02:00
committed by GitHub
parent 986070a597
commit b8faef6857
10 changed files with 242 additions and 43 deletions
+40
View File
@@ -0,0 +1,40 @@
/**
* @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;
};