Skip to content

Commit ef7dbac

Browse files
committed
Deploy Production Code for Commit a04abb8 🚀
1 parent a04abb8 commit ef7dbac

File tree

4,806 files changed

+1262054
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,806 files changed

+1262054
-2
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pids
1616
*.pid.lock
1717

1818
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
19+
# lib-cov
2020

2121
# Coverage directory used by tools like istanbul
2222
coverage
@@ -38,7 +38,7 @@ bower_components
3838
build/Release
3939

4040
# Dependency directories
41-
node_modules/
41+
# node_moduless/
4242
jspm_packages/
4343

4444
# TypeScript v1 declaration files

lib/constants.d.ts

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Describes the action interface.
3+
*/
4+
export interface ActionInterface {
5+
/** Deployment token. */
6+
token?: string;
7+
/** The template to use. */
8+
template: string;
9+
/** The file to replace the content in. */
10+
file: string;
11+
/** The minimum amount sponsored to be included. */
12+
minimum: number;
13+
/** The maximum amount sponsored to be included. */
14+
maximum: number;
15+
/** The marker at which the content should be included within. */
16+
marker: string;
17+
/** If the user has no sponsors, we can replace it with a fallback. */
18+
fallback: string;
19+
/** Fetches organization level sponsors if true. */
20+
organization: boolean;
21+
/** Determines if inactive sponsors should be returned or not. */
22+
activeOnly: boolean;
23+
/** Determines if private sponsors should be returned or not. If marked as true, the identity of the sponsor is still
24+
kept private, however, an anonymized version of the sponsor is still included in the list. */
25+
includePrivate: boolean;
26+
}
27+
/**
28+
* Gets the action configuration.
29+
*/
30+
export declare const action: {
31+
token: string;
32+
template: string;
33+
minimum: number;
34+
maximum: number;
35+
marker: string;
36+
file: string;
37+
fallback: string;
38+
organization: boolean;
39+
activeOnly: boolean;
40+
includePrivate: boolean;
41+
};
42+
/**
43+
* Describes the sponsor object.
44+
*/
45+
export interface Sponsor {
46+
sponsorEntity: {
47+
name: string | null;
48+
login: string;
49+
url: string;
50+
avatarUrl: string;
51+
websiteUrl: string | null;
52+
};
53+
createdAt: string;
54+
privacyLevel?: PrivacyLevel;
55+
tier?: {
56+
monthlyPriceInCents?: number;
57+
};
58+
}
59+
/**
60+
* Describes the response from the GitHub GraphQL query.
61+
*/
62+
export interface SponsorshipsAsMaintainer {
63+
totalCount: number;
64+
pageInfo: {
65+
endCursor: string;
66+
};
67+
nodes: Sponsor[];
68+
}
69+
/**
70+
* Describes the response from the GitHub GraphQL query.
71+
*/
72+
export interface GitHubResponse {
73+
data: {
74+
organization?: {
75+
sponsorshipsAsMaintainer: SponsorshipsAsMaintainer;
76+
};
77+
viewer?: {
78+
sponsorshipsAsMaintainer: SponsorshipsAsMaintainer;
79+
};
80+
};
81+
}
82+
/**
83+
* Describes the action interface.
84+
*/
85+
export type RequiredActionParameters = Pick<ActionInterface, 'token'>;
86+
/**
87+
* Privacy levels for the sponsorship.
88+
*/
89+
export declare enum PrivacyLevel {
90+
PUBLIC = "PUBLIC",
91+
PRIVATE = "PRIVATE"
92+
}
93+
/**
94+
* Statuses for the action.
95+
*/
96+
export declare enum Status {
97+
SUCCESS = "success",
98+
FAILED = "failed",
99+
RUNNING = "running",
100+
SKIPPED = "skipped"
101+
}
102+
/**
103+
* URLs used within the action.
104+
*/
105+
export declare enum Urls {
106+
GITHUB_API = "https://api.github.com"
107+
}

lib/constants.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.Urls = exports.Status = exports.PrivacyLevel = exports.action = void 0;
4+
const core_1 = require("@actions/core");
5+
const util_1 = require("./util");
6+
/**
7+
* Gets the action configuration.
8+
*/
9+
exports.action = {
10+
token: (0, core_1.getInput)('token'),
11+
template: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('template'))
12+
? (0, core_1.getInput)('template')
13+
: `<a href="https://github.com/{{ login }}"><img src="{{ avatarUrl }}" width="60px" alt="{{ name }}" /></a>`,
14+
minimum: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('minimum'))
15+
? parseInt((0, core_1.getInput)('minimum'))
16+
: 0,
17+
maximum: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('maximum'))
18+
? parseInt((0, core_1.getInput)('maximum'))
19+
: 0,
20+
marker: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('marker'))
21+
? (0, core_1.getInput)('marker')
22+
: 'sponsors',
23+
file: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('file')) ? (0, core_1.getInput)('file') : 'README.md',
24+
fallback: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('fallback'))
25+
? (0, core_1.getInput)('fallback')
26+
: ``,
27+
organization: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('organization'))
28+
? (0, core_1.getInput)('organization').toLowerCase() === 'true'
29+
: false,
30+
activeOnly: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('active-only'))
31+
? (0, core_1.getInput)('active-only').toLowerCase() === 'true'
32+
: false,
33+
includePrivate: !(0, util_1.isNullOrUndefined)((0, core_1.getInput)('include-private'))
34+
? (0, core_1.getInput)('include-private').toLowerCase() === 'true'
35+
: false
36+
};
37+
/**
38+
* Privacy levels for the sponsorship.
39+
*/
40+
var PrivacyLevel;
41+
(function (PrivacyLevel) {
42+
PrivacyLevel["PUBLIC"] = "PUBLIC";
43+
PrivacyLevel["PRIVATE"] = "PRIVATE";
44+
})(PrivacyLevel || (exports.PrivacyLevel = PrivacyLevel = {}));
45+
/**
46+
* Statuses for the action.
47+
*/
48+
var Status;
49+
(function (Status) {
50+
Status["SUCCESS"] = "success";
51+
Status["FAILED"] = "failed";
52+
Status["RUNNING"] = "running";
53+
Status["SKIPPED"] = "skipped";
54+
})(Status || (exports.Status = Status = {}));
55+
/**
56+
* URLs used within the action.
57+
*/
58+
var Urls;
59+
(function (Urls) {
60+
Urls["GITHUB_API"] = "https://api.github.com";
61+
})(Urls || (exports.Urls = Urls = {}));

lib/lib.d.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ActionInterface, Status } from './constants';
2+
import { generateFile, getSponsors } from './template';
3+
/** Initializes and runs the action.
4+
*
5+
* @param {ActionInterface} configuration - The configuration object.
6+
*/
7+
export default function run(configuration: ActionInterface): Promise<Status>;
8+
export { generateFile, getSponsors, ActionInterface };

lib/lib.js

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4+
return new (P || (P = Promise))(function (resolve, reject) {
5+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8+
step((generator = generator.apply(thisArg, _arguments || [])).next());
9+
});
10+
};
11+
Object.defineProperty(exports, "__esModule", { value: true });
12+
exports.getSponsors = exports.generateFile = void 0;
13+
const core_1 = require("@actions/core");
14+
const constants_1 = require("./constants");
15+
const template_1 = require("./template");
16+
Object.defineProperty(exports, "generateFile", { enumerable: true, get: function () { return template_1.generateFile; } });
17+
Object.defineProperty(exports, "getSponsors", { enumerable: true, get: function () { return template_1.getSponsors; } });
18+
const util_1 = require("./util");
19+
/** Initializes and runs the action.
20+
*
21+
* @param {ActionInterface} configuration - The configuration object.
22+
*/
23+
function run(configuration) {
24+
return __awaiter(this, void 0, void 0, function* () {
25+
let status = constants_1.Status.RUNNING;
26+
const settings = Object.assign({}, configuration);
27+
try {
28+
(0, core_1.info)(`
29+
30+
██████╗ ██╗████████╗██╗ ██╗██╗ ██╗██████╗
31+
██╔════╝ ██║╚══██╔══╝██║ ██║██║ ██║██╔══██╗
32+
██║ ███╗██║ ██║ ███████║██║ ██║██████╔╝
33+
██║ ██║██║ ██║ ██╔══██║██║ ██║██╔══██╗
34+
╚██████╔╝██║ ██║ ██║ ██║╚██████╔╝██████╔╝
35+
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝
36+
37+
███████╗██████╗ ██████╗ ███╗ ██╗███████╗ ██████╗ ██████╗ ███████╗
38+
██╔════╝██╔══██╗██╔═══██╗████╗ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝
39+
███████╗██████╔╝██║ ██║██╔██╗ ██║███████╗██║ ██║██████╔╝███████╗
40+
╚════██║██╔═══╝ ██║ ██║██║╚██╗██║╚════██║██║ ██║██╔══██╗╚════██║
41+
███████║██║ ╚██████╔╝██║ ╚████║███████║╚██████╔╝██║ ██║███████║
42+
╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
43+
44+
██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗
45+
██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝
46+
██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗
47+
██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝
48+
██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗
49+
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝
50+
51+
█████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗
52+
██╔══██╗██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║
53+
███████║██║ ██║ ██║██║ ██║██╔██╗ ██║
54+
██╔══██║██║ ██║ ██║██║ ██║██║╚██╗██║
55+
██║ ██║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║
56+
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
57+
58+
🚀 Getting Started Guide: https://github.com/JamesIves/github-sponsors-readme-action
59+
❓ Discussions / Q&A: https://github.com/JamesIves/github-sponsors-readme-action/discussions
60+
🔧 Report a Bug: https://github.com/JamesIves/github-sponsors-readme-action/issues
61+
62+
📣 Maintained by James Ives: https://jamesiv.es
63+
💖 Support: https://github.com/sponsors/JamesIves`);
64+
(0, core_1.info)('Checking configuration and initializing… 🚚');
65+
(0, util_1.checkParameters)(settings);
66+
const response = yield (0, template_1.getSponsors)(settings);
67+
status = yield (0, template_1.generateFile)(response, settings);
68+
}
69+
catch (error) {
70+
status = constants_1.Status.FAILED;
71+
(0, core_1.setFailed)((0, util_1.extractErrorMessage)(error));
72+
}
73+
finally {
74+
(0, core_1.info)(`${status === constants_1.Status.FAILED
75+
? 'There was an error generating sponsors. ❌'
76+
: status === constants_1.Status.SUCCESS
77+
? 'The data was successfully retrieved and saved! ✅ 💖'
78+
: `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. ⚠️`}`);
79+
(0, core_1.exportVariable)('sponsorshipStatus', status);
80+
(0, core_1.setOutput)('sponsorshipStatus', status);
81+
}
82+
return status;
83+
});
84+
}
85+
exports.default = run;

lib/main.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

lib/main.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
const constants_1 = require("./constants");
7+
const lib_1 = __importDefault(require("./lib"));
8+
(0, lib_1.default)(constants_1.action);

lib/template.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'cross-fetch/polyfill';
2+
import { ActionInterface, GitHubResponse, Status } from './constants';
3+
/**
4+
* Fetches sponsors from the GitHub Sponsors API.
5+
*/
6+
export declare function getSponsors(action: ActionInterface): Promise<GitHubResponse>;
7+
/**
8+
* Generates the sponsorship template.
9+
*/
10+
export declare function generateTemplate(response: GitHubResponse, action: ActionInterface): string;
11+
/**
12+
* Generates the updated file with the attached sponsorship template.
13+
*/
14+
export declare function generateFile(response: GitHubResponse, action: ActionInterface): Promise<Status>;

0 commit comments

Comments
 (0)