mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-31 05:25:55 +08:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 2541b1294d | ||
|  | 0ffe6f9c55 | ||
|  | dcd71f6466 | ||
|  | add3486cc3 | ||
|  | 5126516654 | ||
|  | d50f8ea767 | ||
|  | 2d1c1198e7 | ||
|  | a12a3943b4 | ||
|  | 8f9e05e482 | 
							
								
								
									
										6
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							| @@ -22,12 +22,12 @@ jobs: | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Set Node.js 12.x | ||||
|       - name: Set Node.js 16.x | ||||
|         uses: actions/setup-node@v1 | ||||
|         with: | ||||
|           node-version: 12.x | ||||
|           node-version: 16.x | ||||
|  | ||||
|       - name: Install dependencies | ||||
|         run: npm ci | ||||
|   | ||||
							
								
								
									
										2
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							| @@ -39,7 +39,7 @@ jobs: | ||||
|  | ||||
|     steps: | ||||
|     - name: Checkout repository | ||||
|       uses: actions/checkout@v2 | ||||
|       uses: actions/checkout@v3 | ||||
|  | ||||
|     - name: Initialize CodeQL | ||||
|       uses: github/codeql-action/init@v1 | ||||
|   | ||||
							
								
								
									
										2
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							| @@ -9,6 +9,6 @@ jobs: | ||||
|     runs-on: ubuntu-latest | ||||
|     name: Check licenses | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/checkout@v3 | ||||
|       - run: npm ci | ||||
|       - run: npm run licensed-check | ||||
							
								
								
									
										12
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,8 +13,8 @@ jobs: | ||||
|     steps: | ||||
|       - uses: actions/setup-node@v1 | ||||
|         with: | ||||
|           node-version: 12.x | ||||
|       - uses: actions/checkout@v2 | ||||
|           node-version: 16.x | ||||
|       - uses: actions/checkout@v3 | ||||
|       - run: npm ci | ||||
|       - run: npm run build | ||||
|       - run: npm run format-check | ||||
| @@ -32,7 +32,7 @@ jobs: | ||||
|     steps: | ||||
|       # Clone this repo | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       # Basic checkout | ||||
|       - name: Checkout basic | ||||
| @@ -142,7 +142,7 @@ jobs: | ||||
|       options: --dns 127.0.0.1 | ||||
|     services: | ||||
|       squid-proxy: | ||||
|         image: ubuntu/squid:latest | ||||
|         image: datadog/squid:latest | ||||
|         ports: | ||||
|           - 3128:3128 | ||||
|     env: | ||||
| @@ -150,7 +150,7 @@ jobs: | ||||
|     steps: | ||||
|       # Clone this repo | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       # Basic checkout using git | ||||
|       - name: Checkout basic | ||||
| @@ -182,7 +182,7 @@ jobs: | ||||
|     steps: | ||||
|       # Clone this repo | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       # Basic checkout using git | ||||
|       - name: Checkout basic | ||||
|   | ||||
							
								
								
									
										6
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,9 +1,9 @@ | ||||
| --- | ||||
| name: "@actions/core" | ||||
| version: 1.10.0 | ||||
| version: 1.2.6 | ||||
| type: npm | ||||
| summary: Actions core lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/core | ||||
| summary:  | ||||
| homepage:  | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
|   | ||||
							
								
								
									
										32
									
								
								.licenses/npm/@actions/http-client-2.0.1.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										32
									
								
								.licenses/npm/@actions/http-client-2.0.1.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,32 +0,0 @@ | ||||
| --- | ||||
| name: "@actions/http-client" | ||||
| version: 2.0.1 | ||||
| type: npm | ||||
| summary: Actions Http Client | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/http-client | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE | ||||
|   text: | | ||||
|     Actions Http Client for Node.js | ||||
| 
 | ||||
|     Copyright (c) GitHub, Inc. | ||||
| 
 | ||||
|     All rights reserved. | ||||
| 
 | ||||
|     MIT License | ||||
| 
 | ||||
|     Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | ||||
|     associated documentation files (the "Software"), to deal in the Software without restriction, | ||||
|     including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||
|     and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||||
|     subject to the following conditions: | ||||
| 
 | ||||
|     The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||||
| 
 | ||||
|     THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||||
|     LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||||
|     NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||||
|     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||||
|     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| notices: [] | ||||
							
								
								
									
										6
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.licenses/npm/@actions/io.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,15 +1,13 @@ | ||||
| --- | ||||
| name: "@actions/io" | ||||
| version: 1.1.2 | ||||
| version: 1.0.1 | ||||
| type: npm | ||||
| summary: Actions io lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/io | ||||
| homepage: https://github.com/actions/toolkit/tree/master/packages/io | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
|   text: |- | ||||
|     The MIT License (MIT) | ||||
| 
 | ||||
|     Copyright 2019 GitHub | ||||
| 
 | ||||
|     Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||||
|   | ||||
							
								
								
									
										2
									
								
								.licenses/npm/qs.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/qs.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| --- | ||||
| name: qs | ||||
| version: 6.11.0 | ||||
| version: 6.10.1 | ||||
| type: npm | ||||
| summary: A querystring parser that supports nesting and arrays, with a depth limit | ||||
| homepage: https://github.com/ljharb/qs | ||||
|   | ||||
							
								
								
									
										20
									
								
								.licenses/npm/uuid-8.3.2.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										20
									
								
								.licenses/npm/uuid-8.3.2.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,20 +0,0 @@ | ||||
| --- | ||||
| name: uuid | ||||
| version: 8.3.2 | ||||
| type: npm | ||||
| summary: RFC4122 (v1, v4, and v5) UUIDs | ||||
| homepage:  | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
|   text: | | ||||
|     The MIT License (MIT) | ||||
| 
 | ||||
|     Copyright (c) 2010-2020 Robert Kieffer and other contributors | ||||
| 
 | ||||
|     Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||||
| 
 | ||||
|     The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||||
| 
 | ||||
|     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
| notices: [] | ||||
| @@ -3,7 +3,7 @@ name: uuid | ||||
| version: 3.3.3 | ||||
| type: npm | ||||
| summary: RFC4122 (v1, v4, and v5) UUIDs | ||||
| homepage:  | ||||
| homepage: https://github.com/kelektiv/node-uuid#readme | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
							
								
								
									
										15
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,19 +1,20 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## v2.5.0 | ||||
| - [Bump @actions/core to v1.10.0](https://github.com/actions/checkout/pull/962) | ||||
| ## v3.0.2 | ||||
| - [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/770) | ||||
|  | ||||
| ## v2.4.2 | ||||
| - [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/776) | ||||
| ## v3.0.1 | ||||
| - [Fixed an issue where checkout failed to run in container jobs due to the new git setting `safe.directory`](https://github.com/actions/checkout/pull/762) | ||||
| - [Bumped various npm package versions](https://github.com/actions/checkout/pull/744) | ||||
|  | ||||
| ## v2.4.1 | ||||
| - [Set the safe directory option on git to prevent git commands failing when running in containers](https://github.com/actions/checkout/pull/762) | ||||
| ## v3.0.0 | ||||
|  | ||||
| - [Update to node 16](https://github.com/actions/checkout/pull/689) | ||||
|  | ||||
| ## v2.3.1 | ||||
|  | ||||
| - [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284) | ||||
|  | ||||
|  | ||||
| ## v2.3.0 | ||||
|  | ||||
| - [Fallback to the default branch](https://github.com/actions/checkout/pull/278) | ||||
|   | ||||
							
								
								
									
										45
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								README.md
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | ||||
|   <a href="https://github.com/actions/checkout"><img alt="GitHub Actions status" src="https://github.com/actions/checkout/workflows/test-local/badge.svg"></a> | ||||
| </p> | ||||
|  | ||||
| # Checkout V2 | ||||
| # Checkout V3 | ||||
|  | ||||
| This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it. | ||||
|  | ||||
| @@ -14,27 +14,14 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | ||||
|  | ||||
| # What's new | ||||
|  | ||||
| - Improved performance | ||||
|   - Fetches only a single commit by default | ||||
| - Script authenticated git commands | ||||
|   - Auth token persisted in the local git config | ||||
| - Supports SSH | ||||
| - Creates a local branch | ||||
|   - No longer detached HEAD when checking out a branch | ||||
| - Improved layout | ||||
|   - The input `path` is always relative to $GITHUB_WORKSPACE | ||||
|   - Aligns better with container actions, where $GITHUB_WORKSPACE gets mapped in | ||||
| - Fallback to REST API download | ||||
|   - When Git 2.18 or higher is not in the PATH, the REST API will be used to download the files | ||||
|   - When using a job container, the container's PATH is used | ||||
|  | ||||
| Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous versions. | ||||
| - Updated to the node16 runtime by default | ||||
|   - This requires a minimum [Actions Runner](https://github.com/actions/runner/releases/tag/v2.285.0) version of v2.285.0 to run, which is by default available in GHES 3.4 or later. | ||||
|  | ||||
| # Usage | ||||
|  | ||||
| <!-- start usage --> | ||||
| ```yaml | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/checkout@v3 | ||||
|   with: | ||||
|     # Repository name with owner. For example, actions/checkout | ||||
|     # Default: ${{ github.repository }} | ||||
| @@ -128,7 +115,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
| ## Fetch all history for all tags and branches | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/checkout@v3 | ||||
|   with: | ||||
|     fetch-depth: 0 | ||||
| ``` | ||||
| @@ -136,7 +123,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
| ## Checkout a different branch | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/checkout@v3 | ||||
|   with: | ||||
|     ref: my-branch | ||||
| ``` | ||||
| @@ -144,7 +131,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
| ## Checkout HEAD^ | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/checkout@v3 | ||||
|   with: | ||||
|     fetch-depth: 2 | ||||
| - run: git checkout HEAD^ | ||||
| @@ -154,12 +141,12 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
|  | ||||
| ```yaml | ||||
| - name: Checkout | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|   with: | ||||
|     path: main | ||||
|  | ||||
| - name: Checkout tools repo | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|   with: | ||||
|     repository: my-org/my-tools | ||||
|     path: my-tools | ||||
| @@ -169,10 +156,10 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
|  | ||||
| ```yaml | ||||
| - name: Checkout | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|  | ||||
| - name: Checkout tools repo | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|   with: | ||||
|     repository: my-org/my-tools | ||||
|     path: my-tools | ||||
| @@ -182,12 +169,12 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
|  | ||||
| ```yaml | ||||
| - name: Checkout | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|   with: | ||||
|     path: main | ||||
|  | ||||
| - name: Checkout private tools | ||||
|   uses: actions/checkout@v2 | ||||
|   uses: actions/checkout@v3 | ||||
|   with: | ||||
|     repository: my-org/my-private-tools | ||||
|     token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | ||||
| @@ -200,7 +187,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous | ||||
| ## Checkout pull request HEAD commit instead of merge commit | ||||
|  | ||||
| ```yaml | ||||
| - uses: actions/checkout@v2 | ||||
| - uses: actions/checkout@v3 | ||||
|   with: | ||||
|     ref: ${{ github.event.pull_request.head.sha }} | ||||
| ``` | ||||
| @@ -216,7 +203,7 @@ jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/checkout@v3 | ||||
| ``` | ||||
|  | ||||
| ## Push a commit using the built-in token | ||||
| @@ -227,7 +214,7 @@ jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v2 | ||||
|       - uses: actions/checkout@v3 | ||||
|       - run: | | ||||
|           date > generated.txt | ||||
|           git config user.name github-actions | ||||
|   | ||||
| @@ -72,6 +72,6 @@ inputs: | ||||
|     description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>` | ||||
|     default: true | ||||
| runs: | ||||
|   using: node12 | ||||
|   using: node16 | ||||
|   main: dist/index.js | ||||
|   post: dist/index.js | ||||
|   | ||||
							
								
								
									
										3256
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3256
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4093
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4093
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "checkout", | ||||
|   "version": "2.6.0", | ||||
|   "version": "2.0.2", | ||||
|   "description": "checkout action", | ||||
|   "main": "lib/main.js", | ||||
|   "scripts": { | ||||
| @@ -28,10 +28,10 @@ | ||||
|   }, | ||||
|   "homepage": "https://github.com/actions/checkout#readme", | ||||
|   "dependencies": { | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@actions/core": "^1.2.6", | ||||
|     "@actions/exec": "^1.0.1", | ||||
|     "@actions/github": "^2.2.0", | ||||
|     "@actions/io": "^1.1.2", | ||||
|     "@actions/io": "^1.0.1", | ||||
|     "@actions/tool-cache": "^1.1.2", | ||||
|     "uuid": "^3.3.3" | ||||
|   }, | ||||
| @@ -39,12 +39,11 @@ | ||||
|     "@types/jest": "^27.0.2", | ||||
|     "@types/node": "^12.7.12", | ||||
|     "@types/uuid": "^3.4.6", | ||||
|     "@typescript-eslint/eslint-plugin": "^5.45.0", | ||||
|     "@typescript-eslint/parser": "^5.45.0", | ||||
|     "@typescript-eslint/parser": "^5.1.0", | ||||
|     "@zeit/ncc": "^0.20.5", | ||||
|     "eslint": "^7.32.0", | ||||
|     "eslint-plugin-github": "^4.3.2", | ||||
|     "eslint-plugin-jest": "^25.7.0", | ||||
|     "eslint-plugin-jest": "^25.2.2", | ||||
|     "jest": "^27.3.0", | ||||
|     "jest-circus": "^27.3.0", | ||||
|     "js-yaml": "^3.13.1", | ||||
|   | ||||
| @@ -157,8 +157,7 @@ class GitAuthHelper { | ||||
|       // by process creation audit events, which are commonly logged. For more information, | ||||
|       // refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing | ||||
|       const output = await this.git.submoduleForeach( | ||||
|         // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline | ||||
|         `sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`, | ||||
|         `git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`, | ||||
|         this.settings.nestedSubmodules | ||||
|       ) | ||||
|  | ||||
| @@ -366,8 +365,7 @@ class GitAuthHelper { | ||||
|  | ||||
|     const pattern = regexpHelper.escape(configKey) | ||||
|     await this.git.submoduleForeach( | ||||
|       // wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline | ||||
|       `sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, | ||||
|       `git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`, | ||||
|       true | ||||
|     ) | ||||
|   } | ||||
|   | ||||
| @@ -120,7 +120,7 @@ function updateUsage( | ||||
| } | ||||
|  | ||||
| updateUsage( | ||||
|   'actions/checkout@v2', | ||||
|   'actions/checkout@v3', | ||||
|   path.join(__dirname, '..', '..', 'action.yml'), | ||||
|   path.join(__dirname, '..', '..', 'README.md') | ||||
| ) | ||||
|   | ||||
| @@ -1,60 +1,71 @@ | ||||
| import * as core from '@actions/core' | ||||
| import * as coreCommand from '@actions/core/lib/command' | ||||
|  | ||||
| /** | ||||
|  * Indicates whether the POST action is running | ||||
|  */ | ||||
| export const IsPost = !!core.getState('isPost') | ||||
| export const IsPost = !!process.env['STATE_isPost'] | ||||
|  | ||||
| /** | ||||
|  * The repository path for the POST action. The value is empty during the MAIN action. | ||||
|  */ | ||||
| export const RepositoryPath = core.getState('repositoryPath') | ||||
| export const RepositoryPath = | ||||
|   (process.env['STATE_repositoryPath'] as string) || '' | ||||
|  | ||||
| /** | ||||
|  * The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action. | ||||
|  */ | ||||
| export const PostSetSafeDirectory = core.getState('setSafeDirectory') === 'true' | ||||
| export const PostSetSafeDirectory = | ||||
|   (process.env['STATE_setSafeDirectory'] as string) === 'true' | ||||
|  | ||||
| /** | ||||
|  * The SSH key path for the POST action. The value is empty during the MAIN action. | ||||
|  */ | ||||
| export const SshKeyPath = core.getState('sshKeyPath') | ||||
| export const SshKeyPath = (process.env['STATE_sshKeyPath'] as string) || '' | ||||
|  | ||||
| /** | ||||
|  * The SSH known hosts path for the POST action. The value is empty during the MAIN action. | ||||
|  */ | ||||
| export const SshKnownHostsPath = core.getState('sshKnownHostsPath') | ||||
| export const SshKnownHostsPath = | ||||
|   (process.env['STATE_sshKnownHostsPath'] as string) || '' | ||||
|  | ||||
| /** | ||||
|  * Save the repository path so the POST action can retrieve the value. | ||||
|  */ | ||||
| export function setRepositoryPath(repositoryPath: string) { | ||||
|   core.saveState('repositoryPath', repositoryPath) | ||||
|   coreCommand.issueCommand( | ||||
|     'save-state', | ||||
|     {name: 'repositoryPath'}, | ||||
|     repositoryPath | ||||
|   ) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Save the SSH key path so the POST action can retrieve the value. | ||||
|  */ | ||||
| export function setSshKeyPath(sshKeyPath: string) { | ||||
|   core.saveState('sshKeyPath', sshKeyPath) | ||||
|   coreCommand.issueCommand('save-state', {name: 'sshKeyPath'}, sshKeyPath) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Save the SSH known hosts path so the POST action can retrieve the value. | ||||
|  */ | ||||
| export function setSshKnownHostsPath(sshKnownHostsPath: string) { | ||||
|   core.saveState('sshKnownHostsPath', sshKnownHostsPath) | ||||
|   coreCommand.issueCommand( | ||||
|     'save-state', | ||||
|     {name: 'sshKnownHostsPath'}, | ||||
|     sshKnownHostsPath | ||||
|   ) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Save the sef-safe-directory input so the POST action can retrieve the value. | ||||
|  */ | ||||
| export function setSafeDirectory() { | ||||
|   core.saveState('setSafeDirectory', 'true') | ||||
|   coreCommand.issueCommand('save-state', {name: 'setSafeDirectory'}, 'true') | ||||
| } | ||||
|  | ||||
| // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic. | ||||
| // This is necessary since we don't have a separate entry point. | ||||
| if (!IsPost) { | ||||
|   core.saveState('isPost', 'true') | ||||
|   coreCommand.issueCommand('save-state', {name: 'isPost'}, 'true') | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user