Skip to content

Commit

Permalink
Deploy Production Code for Commit a04abb8 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Sep 1, 2024
1 parent a04abb8 commit ef7dbac
Show file tree
Hide file tree
Showing 4,806 changed files with 1,262,054 additions and 2 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pids
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# lib-cov

# Coverage directory used by tools like istanbul
coverage
Expand All @@ -38,7 +38,7 @@ bower_components
build/Release

# Dependency directories
node_modules/
# node_moduless/
jspm_packages/

# TypeScript v1 declaration files
Expand Down
107 changes: 107 additions & 0 deletions lib/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* Describes the action interface.
*/
export interface ActionInterface {
/** Deployment token. */
token?: string;
/** The template to use. */
template: string;
/** The file to replace the content in. */
file: string;
/** The minimum amount sponsored to be included. */
minimum: number;
/** The maximum amount sponsored to be included. */
maximum: number;
/** The marker at which the content should be included within. */
marker: string;
/** If the user has no sponsors, we can replace it with a fallback. */
fallback: string;
/** Fetches organization level sponsors if true. */
organization: boolean;
/** Determines if inactive sponsors should be returned or not. */
activeOnly: boolean;
/** Determines if private sponsors should be returned or not. If marked as true, the identity of the sponsor is still
kept private, however, an anonymized version of the sponsor is still included in the list. */
includePrivate: boolean;
}
/**
* Gets the action configuration.
*/
export declare const action: {
token: string;
template: string;
minimum: number;
maximum: number;
marker: string;
file: string;
fallback: string;
organization: boolean;
activeOnly: boolean;
includePrivate: boolean;
};
/**
* Describes the sponsor object.
*/
export interface Sponsor {
sponsorEntity: {
name: string | null;
login: string;
url: string;
avatarUrl: string;
websiteUrl: string | null;
};
createdAt: string;
privacyLevel?: PrivacyLevel;
tier?: {
monthlyPriceInCents?: number;
};
}
/**
* Describes the response from the GitHub GraphQL query.
*/
export interface SponsorshipsAsMaintainer {
totalCount: number;
pageInfo: {
endCursor: string;
};
nodes: Sponsor[];
}
/**
* Describes the response from the GitHub GraphQL query.
*/
export interface GitHubResponse {
data: {
organization?: {
sponsorshipsAsMaintainer: SponsorshipsAsMaintainer;
};
viewer?: {
sponsorshipsAsMaintainer: SponsorshipsAsMaintainer;
};
};
}
/**
* Describes the action interface.
*/
export type RequiredActionParameters = Pick<ActionInterface, 'token'>;
/**
* Privacy levels for the sponsorship.
*/
export declare enum PrivacyLevel {
PUBLIC = "PUBLIC",
PRIVATE = "PRIVATE"
}
/**
* Statuses for the action.
*/
export declare enum Status {
SUCCESS = "success",
FAILED = "failed",
RUNNING = "running",
SKIPPED = "skipped"
}
/**
* URLs used within the action.
*/
export declare enum Urls {
GITHUB_API = "https://api.github.com"
}
61 changes: 61 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Urls = exports.Status = exports.PrivacyLevel = exports.action = void 0;
const core_1 = require("@actions/core");
const util_1 = require("./util");
/**
* Gets the action configuration.
*/
exports.action = {
token: (0, core_1.getInput)('token'),
template: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('template'))
? (0, core_1.getInput)('template')
: `<a href="https://github.com/{{ login }}"><img src="{{ avatarUrl }}" width="60px" alt="{{ name }}" /></a>`,
minimum: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('minimum'))
? parseInt((0, core_1.getInput)('minimum'))
: 0,
maximum: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('maximum'))
? parseInt((0, core_1.getInput)('maximum'))
: 0,
marker: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('marker'))
? (0, core_1.getInput)('marker')
: 'sponsors',
file: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('file')) ? (0, core_1.getInput)('file') : 'README.md',
fallback: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('fallback'))
? (0, core_1.getInput)('fallback')
: ``,
organization: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('organization'))
? (0, core_1.getInput)('organization').toLowerCase() === 'true'
: false,
activeOnly: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('active-only'))
? (0, core_1.getInput)('active-only').toLowerCase() === 'true'
: false,
includePrivate: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('include-private'))
? (0, core_1.getInput)('include-private').toLowerCase() === 'true'
: false
};
/**
* Privacy levels for the sponsorship.
*/
var PrivacyLevel;
(function (PrivacyLevel) {
PrivacyLevel["PUBLIC"] = "PUBLIC";
PrivacyLevel["PRIVATE"] = "PRIVATE";
})(PrivacyLevel || (exports.PrivacyLevel = PrivacyLevel = {}));
/**
* Statuses for the action.
*/
var Status;
(function (Status) {
Status["SUCCESS"] = "success";
Status["FAILED"] = "failed";
Status["RUNNING"] = "running";
Status["SKIPPED"] = "skipped";
})(Status || (exports.Status = Status = {}));
/**
* URLs used within the action.
*/
var Urls;
(function (Urls) {
Urls["GITHUB_API"] = "https://api.github.com";
})(Urls || (exports.Urls = Urls = {}));
8 changes: 8 additions & 0 deletions lib/lib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ActionInterface, Status } from './constants';
import { generateFile, getSponsors } from './template';
/** Initializes and runs the action.
*
* @param {ActionInterface} configuration - The configuration object.
*/
export default function run(configuration: ActionInterface): Promise<Status>;
export { generateFile, getSponsors, ActionInterface };
85 changes: 85 additions & 0 deletions lib/lib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSponsors = exports.generateFile = void 0;
const core_1 = require("@actions/core");
const constants_1 = require("./constants");
const template_1 = require("./template");
Object.defineProperty(exports, "generateFile", { enumerable: true, get: function () { return template_1.generateFile; } });
Object.defineProperty(exports, "getSponsors", { enumerable: true, get: function () { return template_1.getSponsors; } });
const util_1 = require("./util");
/** Initializes and runs the action.
*
* @param {ActionInterface} configuration - The configuration object.
*/
function run(configuration) {
return __awaiter(this, void 0, void 0, function* () {
let status = constants_1.Status.RUNNING;
const settings = Object.assign({}, configuration);
try {
(0, core_1.info)(`
██████╗ ██╗████████╗██╗ ██╗██╗ ██╗██████╗
██╔════╝ ██║╚══██╔══╝██║ ██║██║ ██║██╔══██╗
██║ ███╗██║ ██║ ███████║██║ ██║██████╔╝
██║ ██║██║ ██║ ██╔══██║██║ ██║██╔══██╗
╚██████╔╝██║ ██║ ██║ ██║╚██████╔╝██████╔╝
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝
███████╗██████╗ ██████╗ ███╗ ██╗███████╗ ██████╗ ██████╗ ███████╗
██╔════╝██╔══██╗██╔═══██╗████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝
███████╗██████╔╝██║ ██║██╔██╗ ██║███████╗██║ ██║██████╔╝███████╗
╚════██║██╔═══╝ ██║ ██║██║╚██╗██║╚════██║██║ ██║██╔══██╗╚════██║
███████║██║ ╚██████╔╝██║ ╚████║███████║╚██████╔╝██║ ██║███████║
╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝
██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗
██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝
██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝
█████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗
██╔══██╗██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║
███████║██║ ██║ ██║██║ ██║██╔██╗ ██║
██╔══██║██║ ██║ ██║██║ ██║██║╚██╗██║
██║ ██║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
🚀 Getting Started Guide: https://github.com/JamesIves/github-sponsors-readme-action
❓ Discussions / Q&A: https://github.com/JamesIves/github-sponsors-readme-action/discussions
🔧 Report a Bug: https://github.com/JamesIves/github-sponsors-readme-action/issues
📣 Maintained by James Ives: https://jamesiv.es
💖 Support: https://github.com/sponsors/JamesIves`);
(0, core_1.info)('Checking configuration and initializing… 🚚');
(0, util_1.checkParameters)(settings);
const response = yield (0, template_1.getSponsors)(settings);
status = yield (0, template_1.generateFile)(response, settings);
}
catch (error) {
status = constants_1.Status.FAILED;
(0, core_1.setFailed)((0, util_1.extractErrorMessage)(error));
}
finally {
(0, core_1.info)(`${status === constants_1.Status.FAILED
? 'There was an error generating sponsors. ❌'
: status === constants_1.Status.SUCCESS
? 'The data was successfully retrieved and saved! ✅ 💖'
: `Unable to locate markers in your file, ensure you have a starting and closing tag in your README file. Please check the documentation and try again. ⚠️`}`);
(0, core_1.exportVariable)('sponsorshipStatus', status);
(0, core_1.setOutput)('sponsorshipStatus', status);
}
return status;
});
}
exports.default = run;
1 change: 1 addition & 0 deletions lib/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
8 changes: 8 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const constants_1 = require("./constants");
const lib_1 = __importDefault(require("./lib"));
(0, lib_1.default)(constants_1.action);
14 changes: 14 additions & 0 deletions lib/template.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'cross-fetch/polyfill';
import { ActionInterface, GitHubResponse, Status } from './constants';
/**
* Fetches sponsors from the GitHub Sponsors API.
*/
export declare function getSponsors(action: ActionInterface): Promise<GitHubResponse>;
/**
* Generates the sponsorship template.
*/
export declare function generateTemplate(response: GitHubResponse, action: ActionInterface): string;
/**
* Generates the updated file with the attached sponsorship template.
*/
export declare function generateFile(response: GitHubResponse, action: ActionInterface): Promise<Status>;
Loading

0 comments on commit ef7dbac

Please sign in to comment.