8000 Merge pull request #384 from akv-platform/main · akv-platform/setup-python@4e6b5f4 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e6b5f4

Browse files
Merge pull request actions#384 from akv-platform/main
Add CODE_OF_CONDUCT
2 parents 6a4c6c1 + bcc3137 commit 4e6b5f4

File tree

4 files changed

+107
-56
lines changed

4 files changed

+107
-56
lines changed

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at opensource+actions/setup-python@github.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

dist/cache-save/index.js

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,11 +1148,6 @@ function assertDefined(name, value) {
11481148
return value;
11491149
}
11501150
exports.assertDefined = assertDefined;
1151-
function isGhes() {
1152-
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
1153-
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
1154-
}
1155-
exports.isGhes = isGhes;
11561151
//# sourceMappingURL=cacheUtils.js.map
11571152

11581153
/***/ }),
@@ -3811,18 +3806,18 @@ function downloadCache(archiveLocation, archivePath, options) {
38113806
exports.downloadCache = downloadCache;
38123807
// Reserve Cache
38133808
function reserveCache(key, paths, options) {
3809+
var _a, _b;
38143810
return __awaiter(this, void 0, void 0, function* () {
38153811
const httpClient = createHttpClient();
38163812
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
38173813
const reserveCacheRequest = {
38183814
key,
3819-
version,
3820-
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
3815+
version
38213816
};
38223817
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
38233818
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
38243819
}));
3825-
return response;
3820+
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
38263821
});
38273822
}
38283823
exports.reserveCache = reserveCache;
@@ -41533,12 +41528,18 @@ exports.restoreCache = restoreCache;
4153341528
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
4153441529
*/
4153541530
function saveCache(paths, key, options) {
41536-
var _a, _b, _c, _d, _e;
4153741531
return __awaiter(this, void 0, void 0, function* () {
4153841532
checkPaths(paths);
4153941533
checkKey(key);
4154041534
const compressionMethod = yield utils.getCompressionMethod();
41541-
let cacheId = null;
41535+
core.debug('Reserving Cache');
41536+
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
41537+
compressionMethod
41538+
});
41539+
if (cacheId === -1) {
41540+
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
41541+
}
41542+
core.debug(`Cache ID: ${cacheId}`);
4154241543
const cachePaths = yield utils.resolvePaths(paths);
4154341544
core.debug('Cache Paths:');
4154441545
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -41553,24 +41554,9 @@ function saveCache(paths, key, options) {
4155341554
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
4155441555
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
4155541556
core.debug(`File Size: ${archiveFileSize}`);
41556-
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
41557-
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
41557+
if (archiveFileSize > fileSizeLimit) {
4155841558
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
4155941559
}
41560-
core.debug('Reserving Cache');
41561-
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
41562-
compressionMethod,
41563-
cacheSize: archiveFileSize
41564-
});
41565-
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
41566-
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
41567-
}
41568-
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
41569-
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
41570-
}
41571-
else {
41572-
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
41573-
}
4157441560
core.debug(`Saving Cache (ID: ${cacheId})`);
4157541561
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
4157641562
}
@@ -50349,8 +50335,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
5034950335
return {
5035050336
statusCode: error.statusCode,
5035150337
result: null,
50352-
headers: {},
50353-
error
50338+
headers: {}
5035450339
};
5035550340
}
5035650341
else {

dist/setup/index.js

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,11 +1148,6 @@ function assertDefined(name, value) {
11481148
return value;
11491149
}
11501150
exports.assertDefined = assertDefined;
1151-
function isGhes() {
1152-
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
1153-
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
1154-
}
1155-
exports.isGhes = isGhes;
11561151
//# sourceMappingURL=cacheUtils.js.map
11571152

11581153
/***/ }),
@@ -3964,18 +3959,18 @@ function downloadCache(archiveLocation, archivePath, options) {
39643959
exports.downloadCache = downloadCache;
39653960
// Reserve Cache
39663961
function reserveCache(key, paths, options) {
3962+
var _a, _b;
39673963
return __awaiter(this, void 0, void 0, function* () {
39683964
const httpClient = createHttpClient();
39693965
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
39703966
const reserveCacheRequest = {
39713967
key,
3972-
version,
3973-
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
3968+
version
39743969
};
39753970
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
39763971
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
39773972
}));
3978-
return response;
3973+
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
39793974
});
39803975
}
39813976
exports.reserveCache = reserveCache;
@@ -6112,6 +6107,9 @@ function run() {
61126107
yield cacheDependencies(cache, pythonVersion);
61136108
}
61146109
}
6110+
else {
6111+
throw new Error('there\'s empty python-version input');
6112+
}
61156113
const matchersPath = path.join(__dirname, '../..', '.github');
61166114
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
61176115
}
@@ -47087,12 +47085,18 @@ exports.restoreCache = restoreCache;
4708747085
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
4708847086
*/
4708947087
function saveCache(paths, key, options) {
47090-
var _a, _b, _c, _d, _e;
4709147088
return __awaiter(this, void 0, void 0, function* () {
4709247089
checkPaths(paths);
4709347090
checkKey(key);
4709447091
const compressionMethod = yield utils.getCompressionMethod();
47095-
let cacheId = null;
47092+
core.debug('Reserving Cache');
47093+
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
47094+
compressionMethod
47095+
});
47096+
if (cacheId === -1) {
47097+
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
47098+
}
47099+
core.debug(`Cache ID: ${cacheId}`);
4709647100
const cachePaths = yield utils.resolvePaths(paths);
4709747101
core.debug('Cache Paths:');
4709847102
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -47107,24 +47111,9 @@ function saveCache(paths, key, options) {
4710747111
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
4710847112
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
4710947113
core.debug(`File Size: ${archiveFileSize}`);
47110-
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
47111-
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
47114+
if (archiveFileSize > fileSizeLimit) {
4711247115
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
4711347116
}
47114-
core.debug('Reserving Cache');
47115-
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
47116-
compressionMethod,
47117-
cacheSize: archiveFileSize
47118-
});
47119-
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
47120-
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
47121-
}
47122-
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
47123-
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
47124-
}
47125-
else {
47126-
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
47127-
}
4712847117
core.debug(`Saving Cache (ID: ${cacheId})`);
4712947118
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
4713047119
}
@@ -56433,8 +56422,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
5643356422
return {
5643456423
statusCode: error.statusCode,
5643556424
result: null,
56436-
headers: {},
56437-
error
56425+
headers: {}
5643856426
};
5643956427
}
5644056428
else {

src/setup-python.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ async function run() {
5353
if (cache && isCacheFeatureAvailable()) {
5454
await cacheDependencies(cache, pythonVersion);
5555
}
56+
} else {
57+
throw new Error('there\'s empty python-version input')
5658
}
5759
const matchersPath = path.join(__dirname, '../..', '.github');
5860
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);

0 commit comments

Comments
 (0)
0