From 0bcf8ef2baf9ecf42f9ef4875f40aedde003bacf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= <cr52@protonmail.com>
Date: Wed, 12 Jan 2022 10:35:17 +0100
Subject: [PATCH 01/13] DOC: document -dev syntactic sugar

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 1099b3a3..ec831628 100644
--- a/README.md
+++ b/README.md
@@ -150,6 +150,7 @@ Check out our detailed guide on using [Python with GitHub Actions](https://help.
     - For every minor version of Python, expect only the latest patch to be preinstalled.
     - If `3.8.1` is installed for example, and `3.8.2` is released, expect `3.8.1` to be removed and replaced by `3.8.2` in the tools cache.
     - If the exact patch version doesn't matter to you, specifying just the major and minor version will get you the latest preinstalled patch version. In the previous example, the version spec `3.8` will use the `3.8.2` Python version found in the cache.
+    - Use `-dev` instead of a patch number (e.g., `3.11-dev`) to install the latest release of a minor version, *alpha and beta releases included*.
 - Downloadable Python versions from GitHub Releases ([actions/python-versions](https://github.com/actions/python-versions/releases)).
     - All available versions are listed in the [version-manifest.json](https://github.com/actions/python-versions/blob/main/versions-manifest.json) file.
     - If there is a specific version of Python that is not available, you can open an issue here

From 4176166af9c0d1a5c7f4af4b6e8fdf10b671c986 Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Mon, 18 Apr 2022 16:04:39 +0500
Subject: [PATCH 02/13] Add CODE_OF_CONDUCT

---
 CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 CODE_OF_CONDUCT.md

diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..e859bbac
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to make participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+  advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+  address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies within all project spaces, and it also applies when
+an individual is representing the project or its community in public spaces.
+Examples of representing a project or community include using an official
+project e-mail address, posting via an official social media account, or acting
+as an appointed representative at an online or offline event. Representation of
+a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at opensource+actions/setup-python@github.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq

From 6a4c6c13094a805ef8e6d627d55b4aed596ebcea Mon Sep 17 00:00:00 2001
From: Dmitry Shibanov <shibanov-1997@inbox.ru>
Date: Wed, 20 Apr 2022 14:48:22 +0200
Subject: [PATCH 03/13] adjust documentation for python versions (#388)

---
 README.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/README.md b/README.md
index 8928488a..68956645 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,8 @@ Check out our detailed guide on using [Python with GitHub Actions](https://help.
     - All available versions are listed in the [version-manifest.json](https://github.com/actions/python-versions/blob/main/versions-manifest.json) file.
     - If there is a specific version of Python that is not available, you can open an issue here
 
+**Note:** Python versions used in this action are generated in the [python-versions](https://github.com/actions/python-versions) repository. For macOS and Ubuntu images python versions are built from the source code. For Windows the python-versions repository uses installation executable. For more information please refer to the [python-versions](https://github.com/actions/python-versions) repository.
+
  # Available versions of PyPy
 
  `setup-python` is able to configure PyPy from two sources:

From bcc31375e15339f9960d3e3ca1cffaa6ed26c578 Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Thu, 21 Apr 2022 08:16:43 +0500
Subject: [PATCH 04/13] Throw exe on empty python-version

---
 dist/cache-save/index.js | 41 ++++++++++++-------------------------
 dist/setup/index.js      | 44 +++++++++++++++-------------------------
 src/setup-python.ts      |  2 ++
 3 files changed, 31 insertions(+), 56 deletions(-)

diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js
index 3c1d1c82..c1c654f2 100644
--- a/dist/cache-save/index.js
+++ b/dist/cache-save/index.js
@@ -1148,11 +1148,6 @@ function assertDefined(name, value) {
     return value;
 }
 exports.assertDefined = assertDefined;
-function isGhes() {
-    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
-    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
-}
-exports.isGhes = isGhes;
 //# sourceMappingURL=cacheUtils.js.map
 
 /***/ }),
@@ -3811,18 +3806,18 @@ function downloadCache(archiveLocation, archivePath, options) {
 exports.downloadCache = downloadCache;
 // Reserve Cache
 function reserveCache(key, paths, options) {
+    var _a, _b;
     return __awaiter(this, void 0, void 0, function* () {
         const httpClient = createHttpClient();
         const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
         const reserveCacheRequest = {
             key,
-            version,
-            cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
+            version
         };
         const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
             return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
         }));
-        return response;
+        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;
     });
 }
 exports.reserveCache = reserveCache;
@@ -41533,12 +41528,18 @@ exports.restoreCache = restoreCache;
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
  */
 function saveCache(paths, key, options) {
-    var _a, _b, _c, _d, _e;
     return __awaiter(this, void 0, void 0, function* () {
         checkPaths(paths);
         checkKey(key);
         const compressionMethod = yield utils.getCompressionMethod();
-        let cacheId = null;
+        core.debug('Reserving Cache');
+        const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
+            compressionMethod
+        });
+        if (cacheId === -1) {
+            throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
+        }
+        core.debug(`Cache ID: ${cacheId}`);
         const cachePaths = yield utils.resolvePaths(paths);
         core.debug('Cache Paths:');
         core.debug(`${JSON.stringify(cachePaths)}`);
@@ -41553,24 +41554,9 @@ function saveCache(paths, key, options) {
             const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
             const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
             core.debug(`File Size: ${archiveFileSize}`);
-            // For GHES, this check will take place in ReserveCache API with enterprise file size limit
-            if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
+            if (archiveFileSize > fileSizeLimit) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
-            core.debug('Reserving Cache');
-            const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
-                compressionMethod,
-                cacheSize: archiveFileSize
-            });
-            if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
-                cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
-            }
-            else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
-                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.`);
-            }
-            else {
-                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}`);
-            }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
         }
@@ -50349,8 +50335,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
                 return {
                     statusCode: error.statusCode,
                     result: null,
-                    headers: {},
-                    error
+                    headers: {}
                 };
             }
             else {
diff --git a/dist/setup/index.js b/dist/setup/index.js
index c51a5f77..ca18baa2 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -1148,11 +1148,6 @@ function assertDefined(name, value) {
     return value;
 }
 exports.assertDefined = assertDefined;
-function isGhes() {
-    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
-    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
-}
-exports.isGhes = isGhes;
 //# sourceMappingURL=cacheUtils.js.map
 
 /***/ }),
@@ -3964,18 +3959,18 @@ function downloadCache(archiveLocation, archivePath, options) {
 exports.downloadCache = downloadCache;
 // Reserve Cache
 function reserveCache(key, paths, options) {
+    var _a, _b;
     return __awaiter(this, void 0, void 0, function* () {
         const httpClient = createHttpClient();
         const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
         const reserveCacheRequest = {
             key,
-            version,
-            cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
+            version
         };
         const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
             return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
         }));
-        return response;
+        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;
     });
 }
 exports.reserveCache = reserveCache;
@@ -6112,6 +6107,9 @@ function run() {
                     yield cacheDependencies(cache, pythonVersion);
                 }
             }
+            else {
+                throw new Error('there\'s empty python-version input');
+            }
             const matchersPath = path.join(__dirname, '../..', '.github');
             core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
         }
@@ -47087,12 +47085,18 @@ exports.restoreCache = restoreCache;
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
  */
 function saveCache(paths, key, options) {
-    var _a, _b, _c, _d, _e;
     return __awaiter(this, void 0, void 0, function* () {
         checkPaths(paths);
         checkKey(key);
         const compressionMethod = yield utils.getCompressionMethod();
-        let cacheId = null;
+        core.debug('Reserving Cache');
+        const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
+            compressionMethod
+        });
+        if (cacheId === -1) {
+            throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
+        }
+        core.debug(`Cache ID: ${cacheId}`);
         const cachePaths = yield utils.resolvePaths(paths);
         core.debug('Cache Paths:');
         core.debug(`${JSON.stringify(cachePaths)}`);
@@ -47107,24 +47111,9 @@ function saveCache(paths, key, options) {
             const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
             const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
             core.debug(`File Size: ${archiveFileSize}`);
-            // For GHES, this check will take place in ReserveCache API with enterprise file size limit
-            if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
+            if (archiveFileSize > fileSizeLimit) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
-            core.debug('Reserving Cache');
-            const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
-                compressionMethod,
-                cacheSize: archiveFileSize
-            });
-            if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
-                cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
-            }
-            else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
-                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.`);
-            }
-            else {
-                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}`);
-            }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
         }
@@ -56433,8 +56422,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
                 return {
                     statusCode: error.statusCode,
                     result: null,
-                    headers: {},
-                    error
+                    headers: {}
                 };
             }
             else {
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 62c76dba..3340a86e 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -53,6 +53,8 @@ async function run() {
       if (cache && isCacheFeatureAvailable()) {
         await cacheDependencies(cache, pythonVersion);
       }
+    } else {
+      throw new Error('there\'s empty python-version input')
     }
     const matchersPath = path.join(__dirname, '../..', '.github');
     core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);

From c36dc43e7be276cc63ea11161d744cccdc2c731f Mon Sep 17 00:00:00 2001
From: Dmitry Shibanov <shibanov-1997@inbox.ru>
Date: Tue, 26 Apr 2022 16:50:29 +0200
Subject: [PATCH 05/13] Fix conflicts (#389)

---
 dist/cache-save/index.js | 41 +++++++++++++++++++++++++------------
 dist/setup/index.js      | 44 +++++++++++++++++++++++++---------------
 src/setup-python.ts      |  2 --
 3 files changed, 56 insertions(+), 31 deletions(-)

diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js
index c1c654f2..3c1d1c82 100644
--- a/dist/cache-save/index.js
+++ b/dist/cache-save/index.js
@@ -1148,6 +1148,11 @@ function assertDefined(name, value) {
     return value;
 }
 exports.assertDefined = assertDefined;
+function isGhes() {
+    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
+    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
+}
+exports.isGhes = isGhes;
 //# sourceMappingURL=cacheUtils.js.map
 
 /***/ }),
@@ -3806,18 +3811,18 @@ function downloadCache(archiveLocation, archivePath, options) {
 exports.downloadCache = downloadCache;
 // Reserve Cache
 function reserveCache(key, paths, options) {
-    var _a, _b;
     return __awaiter(this, void 0, void 0, function* () {
         const httpClient = createHttpClient();
         const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
         const reserveCacheRequest = {
             key,
-            version
+            version,
+            cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
         };
         const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
             return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
         }));
-        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;
+        return response;
     });
 }
 exports.reserveCache = reserveCache;
@@ -41528,18 +41533,12 @@ exports.restoreCache = restoreCache;
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
  */
 function saveCache(paths, key, options) {
+    var _a, _b, _c, _d, _e;
     return __awaiter(this, void 0, void 0, function* () {
         checkPaths(paths);
         checkKey(key);
         const compressionMethod = yield utils.getCompressionMethod();
-        core.debug('Reserving Cache');
-        const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
-            compressionMethod
-        });
-        if (cacheId === -1) {
-            throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
-        }
-        core.debug(`Cache ID: ${cacheId}`);
+        let cacheId = null;
         const cachePaths = yield utils.resolvePaths(paths);
         core.debug('Cache Paths:');
         core.debug(`${JSON.stringify(cachePaths)}`);
@@ -41554,9 +41553,24 @@ function saveCache(paths, key, options) {
             const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
             const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
             core.debug(`File Size: ${archiveFileSize}`);
-            if (archiveFileSize > fileSizeLimit) {
+            // For GHES, this check will take place in ReserveCache API with enterprise file size limit
+            if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            core.debug('Reserving Cache');
+            const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
+                compressionMethod,
+                cacheSize: archiveFileSize
+            });
+            if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
+                cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
+            }
+            else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
+                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.`);
+            }
+            else {
+                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}`);
+            }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
         }
@@ -50335,7 +50349,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
                 return {
                     statusCode: error.statusCode,
                     result: null,
-                    headers: {}
+                    headers: {},
+                    error
                 };
             }
             else {
diff --git a/dist/setup/index.js b/dist/setup/index.js
index ca18baa2..c51a5f77 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -1148,6 +1148,11 @@ function assertDefined(name, value) {
     return value;
 }
 exports.assertDefined = assertDefined;
+function isGhes() {
+    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
+    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
+}
+exports.isGhes = isGhes;
 //# sourceMappingURL=cacheUtils.js.map
 
 /***/ }),
@@ -3959,18 +3964,18 @@ function downloadCache(archiveLocation, archivePath, options) {
 exports.downloadCache = downloadCache;
 // Reserve Cache
 function reserveCache(key, paths, options) {
-    var _a, _b;
     return __awaiter(this, void 0, void 0, function* () {
         const httpClient = createHttpClient();
         const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
         const reserveCacheRequest = {
             key,
-            version
+            version,
+            cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
         };
         const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
             return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
         }));
-        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;
+        return response;
     });
 }
 exports.reserveCache = reserveCache;
@@ -6107,9 +6112,6 @@ function run() {
                     yield cacheDependencies(cache, pythonVersion);
                 }
             }
-            else {
-                throw new Error('there\'s empty python-version input');
-            }
             const matchersPath = path.join(__dirname, '../..', '.github');
             core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
         }
@@ -47085,18 +47087,12 @@ exports.restoreCache = restoreCache;
  * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
  */
 function saveCache(paths, key, options) {
+    var _a, _b, _c, _d, _e;
     return __awaiter(this, void 0, void 0, function* () {
         checkPaths(paths);
         checkKey(key);
         const compressionMethod = yield utils.getCompressionMethod();
-        core.debug('Reserving Cache');
-        const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
-            compressionMethod
-        });
-        if (cacheId === -1) {
-            throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
-        }
-        core.debug(`Cache ID: ${cacheId}`);
+        let cacheId = null;
         const cachePaths = yield utils.resolvePaths(paths);
         core.debug('Cache Paths:');
         core.debug(`${JSON.stringify(cachePaths)}`);
@@ -47111,9 +47107,24 @@ function saveCache(paths, key, options) {
             const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
             const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
             core.debug(`File Size: ${archiveFileSize}`);
-            if (archiveFileSize > fileSizeLimit) {
+            // For GHES, this check will take place in ReserveCache API with enterprise file size limit
+            if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
                 throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
             }
+            core.debug('Reserving Cache');
+            const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
+                compressionMethod,
+                cacheSize: archiveFileSize
+            });
+            if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
+                cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
+            }
+            else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
+                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.`);
+            }
+            else {
+                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}`);
+            }
             core.debug(`Saving Cache (ID: ${cacheId})`);
             yield cacheHttpClient.saveCache(cacheId, archivePath, options);
         }
@@ -56422,7 +56433,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
                 return {
                     statusCode: error.statusCode,
                     result: null,
-                    headers: {}
+                    headers: {},
+                    error
                 };
             }
             else {
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 3340a86e..62c76dba 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -53,8 +53,6 @@ async function run() {
       if (cache && isCacheFeatureAvailable()) {
         await cacheDependencies(cache, pythonVersion);
       }
-    } else {
-      throw new Error('there\'s empty python-version input')
     }
     const matchersPath = path.join(__dirname, '../..', '.github');
     core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);

From 1ce308808af558cfbcb7218da3af37d92e033ad1 Mon Sep 17 00:00:00 2001
From: Matthieu Darbois <mayeut@users.noreply.github.com>
Date: Thu, 28 Apr 2022 15:26:17 +0200
Subject: [PATCH 06/13] Create missing `pypyX.Y` symlinks (#347)

`pypyX.Y.exe` executables are missing from PyPy archives on Windows before v7.3.9 (X.Y < 3.9)
`pypy2.7` symlinks are also missing from macOS/Linux PyPy archives before v7.3.9

relates to #346
---
 .github/workflows/test-pypy.yml | 14 ++++++++++++++
 dist/setup/index.js             |  3 +++
 src/install-pypy.ts             |  9 +++++++++
 3 files changed, 26 insertions(+)

diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml
index 2bd04410..f6362069 100644
--- a/.github/workflows/test-pypy.yml
+++ b/.github/workflows/test-pypy.yml
@@ -44,3 +44,17 @@ jobs:
   
       - name: Run simple code
         run: python -c 'import math; print(math.factorial(5))'
+
+      - name: Assert PyPy is running
+        run: |
+          import platform
+          assert platform.python_implementation().lower() == "pypy"
+        shell: python
+
+      - name: Assert expected binaries (or symlinks) are present
+        run: |
+          EXECUTABLE=${{ matrix.pypy }}
+          EXECUTABLE=${EXECUTABLE/-/}  # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
+          EXECUTABLE=${EXECUTABLE%%-*}  # remove any -* suffixe
+          ${EXECUTABLE} --version
+        shell: bash
diff --git a/dist/setup/index.js b/dist/setup/index.js
index c51a5f77..7c47a470 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -10283,11 +10283,14 @@ function createPyPySymlink(pypyBinaryPath, pythonVersion) {
     return __awaiter(this, void 0, void 0, function* () {
         const version = semver.coerce(pythonVersion);
         const pythonBinaryPostfix = semver.major(version);
+        const pythonMinor = semver.minor(version);
         const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
+        const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
         let binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
         core.info('Creating symlinks...');
         utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${pythonBinaryPostfix}${binaryExtension}`, true);
         utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${binaryExtension}`, true);
+        utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `pypy${pypyMajorMinorBinaryPostfix}${binaryExtension}`, true);
     });
 }
 function installPip(pythonLocation) {
diff --git a/src/install-pypy.ts b/src/install-pypy.ts
index 402525ab..c3718b79 100644
--- a/src/install-pypy.ts
+++ b/src/install-pypy.ts
@@ -98,7 +98,9 @@ async function createPyPySymlink(
 ) {
   const version = semver.coerce(pythonVersion)!;
   const pythonBinaryPostfix = semver.major(version);
+  const pythonMinor = semver.minor(version);
   const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
+  const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
   let binaryExtension = IS_WINDOWS ? '.exe' : '';
 
   core.info('Creating symlinks...');
@@ -115,6 +117,13 @@ async function createPyPySymlink(
     `python${binaryExtension}`,
     true
   );
+
+  createSymlinkInFolder(
+    pypyBinaryPath,
+    `pypy${pypyBinaryPostfix}${binaryExtension}`,
+    `pypy${pypyMajorMinorBinaryPostfix}${binaryExtension}`,
+    true
+  );
 }
 
 async function installPip(pythonLocation: string) {

From ac4e85883599916740167aed2c652390762f2cb9 Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Fri, 29 Apr 2022 09:14:59 +0500
Subject: [PATCH 07/13] Add warning if python version set to empty value

---
 src/setup-python.ts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/setup-python.ts b/src/setup-python.ts
index 62c76dba..6136237d 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -53,6 +53,10 @@ async function run() {
       if (cache && isCacheFeatureAvailable()) {
         await cacheDependencies(cache, pythonVersion);
       }
+    } else {
+      core.warning(
+        'python-version is empty, the OS native python will be used'
+      );
     }
     const matchersPath = path.join(__dirname, '../..', '.github');
     core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);

From 22daa094b838330a3ab8897dbf26828efd05d952 Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Fri, 29 Apr 2022 09:29:36 +0500
Subject: [PATCH 08/13] Add generated files

---
 dist/setup/index.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index c51a5f77..f5c9fb92 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -6112,6 +6112,9 @@ function run() {
                     yield cacheDependencies(cache, pythonVersion);
                 }
             }
+            else {
+                core.warning('python-version is empty, the OS native python will be used');
+            }
             const matchersPath = path.join(__dirname, '../..', '.github');
             core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
         }

From 0b56b76337193b501b7096345a23f23b2590298b Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Fri, 29 Apr 2022 12:49:49 +0500
Subject: [PATCH 09/13] Improve wording

---
 dist/setup/index.js | 2 +-
 src/setup-python.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index f5c9fb92..367e9ed9 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -6113,7 +6113,7 @@ function run() {
                 }
             }
             else {
-                core.warning('python-version is empty, the OS native python will be used');
+                core.warning("Step input 'python-version' is not set, the OS native python version will be used");
             }
             const matchersPath = path.join(__dirname, '../..', '.github');
             core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 6136237d..25f18b60 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -55,7 +55,7 @@ async function run() {
       }
     } else {
       core.warning(
-        'python-version is empty, the OS native python will be used'
+        "Step input 'python-version' is not set, the OS native python version will be used"
       );
     }
     const matchersPath = path.join(__dirname, '../..', '.github');

From 5e1e05c694d142e423cb60b986245fb0da7367de Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Tue, 3 May 2022 16:04:39 +0500
Subject: [PATCH 10/13] set PKG_CONFIG_PATH environment var

---
 dist/setup/index.js | 2 ++
 src/find-pypy.ts    | 1 +
 src/find-python.ts  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index 7c47a470..141ba7d5 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -52374,6 +52374,7 @@ function findPyPyVersion(versionSpec, architecture) {
         const _binDir = path.join(installDir, pipDir);
         const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
         core.exportVariable('pythonLocation', pythonLocation);
+        core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
         core.addPath(pythonLocation);
         core.addPath(_binDir);
         core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim());
@@ -57009,6 +57010,7 @@ function useCpythonVersion(version, architecture) {
             ].join(os.EOL));
         }
         core.exportVariable('pythonLocation', installDir);
+        core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
         if (utils_1.IS_LINUX) {
             const libPath = process.env.LD_LIBRARY_PATH
                 ? `:${process.env.LD_LIBRARY_PATH}`
diff --git a/src/find-pypy.ts b/src/find-pypy.ts
index 75b6abb0..fd273825 100644
--- a/src/find-pypy.ts
+++ b/src/find-pypy.ts
@@ -50,6 +50,7 @@ export async function findPyPyVersion(
   const _binDir = path.join(installDir, pipDir);
   const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
   core.exportVariable('pythonLocation', pythonLocation);
+  core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
   core.addPath(pythonLocation);
   core.addPath(_binDir);
   core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim());
diff --git a/src/find-python.ts b/src/find-python.ts
index b8175a43..3959ecf1 100644
--- a/src/find-python.ts
+++ b/src/find-python.ts
@@ -70,6 +70,7 @@ export async function useCpythonVersion(
   }
 
   core.exportVariable('pythonLocation', installDir);
+  core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
 
   if (IS_LINUX) {
     const libPath = process.env.LD_LIBRARY_PATH

From a69041ca9f9f72c33ce94580dd70191dd501c392 Mon Sep 17 00:00:00 2001
From: Brian Cristante <33549821+brcrista@users.noreply.github.com>
Date: Tue, 3 May 2022 08:43:53 -0400
Subject: [PATCH 11/13] Successfully set up (#399)

---
 dist/setup/index.js | 4 ++--
 package-lock.json   | 4 ++--
 src/setup-python.ts | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index 7c47a470..1e281a8f 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -6100,12 +6100,12 @@ function run() {
                 if (isPyPyVersion(version)) {
                     const installed = yield finderPyPy.findPyPyVersion(version, arch);
                     pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
-                    core.info(`Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
+                    core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
                 }
                 else {
                     const installed = yield finder.useCpythonVersion(version, arch);
                     pythonVersion = installed.version;
-                    core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
+                    core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
                 }
                 const cache = core.getInput('cache');
                 if (cache && utils_1.isCacheFeatureAvailable()) {
diff --git a/package-lock.json b/package-lock.json
index 8ff8176f..46c3dc4c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "setup-python",
-  "version": "3.1.0",
+  "version": "3.1.1",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "setup-python",
-      "version": "3.1.0",
+      "version": "3.1.1",
       "license": "MIT",
       "dependencies": {
         "@actions/cache": "^2.0.2",
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 62c76dba..37229c59 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -41,12 +41,12 @@ async function run() {
         const installed = await finderPyPy.findPyPyVersion(version, arch);
         pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
         core.info(
-          `Successfully setup PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
+          `Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
         );
       } else {
         const installed = await finder.useCpythonVersion(version, arch);
         pythonVersion = installed.version;
-        core.info(`Successfully setup ${installed.impl} (${pythonVersion})`);
+        core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
       }
 
       const cache = core.getInput('cache');

From e31727ce0a67347596370ec677fbc441cfa3ca90 Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Wed, 4 May 2022 12:43:58 +0500
Subject: [PATCH 12/13] Improve warning message

Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
---
 src/setup-python.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/setup-python.ts b/src/setup-python.ts
index 25f18b60..3584b59a 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -55,7 +55,7 @@ async function run() {
       }
     } else {
       core.warning(
-        "Step input 'python-version' is not set, the OS native python version will be used"
+        "The `python-version` input is not set.  The version of Python currently in `PATH` will be used."
       );
     }
     const matchersPath = path.join(__dirname, '../..', '.github');

From 8f73c1495f8947f3553ede54257c5ff89825432b Mon Sep 17 00:00:00 2001
From: Sergey Dolin <sergey.dolin@gmail.com>
Date: Wed, 4 May 2022 12:55:36 +0500
Subject: [PATCH 13/13] Formatting

---
 dist/setup/index.js | 2 +-
 src/setup-python.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/setup/index.js b/dist/setup/index.js
index 367e9ed9..86edc53c 100644
--- a/dist/setup/index.js
+++ b/dist/setup/index.js
@@ -6113,7 +6113,7 @@ function run() {
                 }
             }
             else {
-                core.warning("Step input 'python-version' is not set, the OS native python version will be used");
+                core.warning('The `python-version` input is not set.  The version of Python currently in `PATH` will be used.');
             }
             const matchersPath = path.join(__dirname, '../..', '.github');
             core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
diff --git a/src/setup-python.ts b/src/setup-python.ts
index 3584b59a..14700b7b 100644
--- a/src/setup-python.ts
+++ b/src/setup-python.ts
@@ -55,7 +55,7 @@ async function run() {
       }
     } else {
       core.warning(
-        "The `python-version` input is not set.  The version of Python currently in `PATH` will be used."
+        'The `python-version` input is not set.  The version of Python currently in `PATH` will be used.'
       );
     }
     const matchersPath = path.join(__dirname, '../..', '.github');