mirror of
				https://github.com/actions/checkout.git
				synced 2025-10-30 23:10:31 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | e2f20e631a | ||
|   | b2eb13baee | ||
|   | 7884fcad6b | ||
|   | f67ee5d622 | ||
|   | f25a3a9f25 | 
							
								
								
									
										6
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							| @@ -22,12 +22,12 @@ jobs: | |||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|       - name: Set Node.js 16.x |       - name: Set Node.js 12.x | ||||||
|         uses: actions/setup-node@v1 |         uses: actions/setup-node@v1 | ||||||
|         with: |         with: | ||||||
|           node-version: 16.x |           node-version: 12.x | ||||||
|  |  | ||||||
|       - name: Install dependencies |       - name: Install dependencies | ||||||
|         run: npm ci |         run: npm ci | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							| @@ -39,7 +39,7 @@ jobs: | |||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout repository |     - name: Checkout repository | ||||||
|       uses: actions/checkout@v3 |       uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|     - name: Initialize CodeQL |     - name: Initialize CodeQL | ||||||
|       uses: github/codeql-action/init@v1 |       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 |     runs-on: ubuntu-latest | ||||||
|     name: Check licenses |     name: Check licenses | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v2 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: npm run licensed-check |       - run: npm run licensed-check | ||||||
							
								
								
									
										48
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										48
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,8 +13,8 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       - uses: actions/setup-node@v1 |       - uses: actions/setup-node@v1 | ||||||
|         with: |         with: | ||||||
|           node-version: 16.x |           node-version: 12.x | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v2 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: npm run build |       - run: npm run build | ||||||
|       - run: npm run format-check |       - run: npm run format-check | ||||||
| @@ -32,7 +32,7 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       # Clone this repo |       # Clone this repo | ||||||
|       - name: Checkout |       - name: Checkout | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|       # Basic checkout |       # Basic checkout | ||||||
|       - name: Checkout basic |       - name: Checkout basic | ||||||
| @@ -150,7 +150,7 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       # Clone this repo |       # Clone this repo | ||||||
|       - name: Checkout |       - name: Checkout | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|       # Basic checkout using git |       # Basic checkout using git | ||||||
|       - name: Checkout basic |       - name: Checkout basic | ||||||
| @@ -182,7 +182,7 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       # Clone this repo |       # Clone this repo | ||||||
|       - name: Checkout |       - name: Checkout | ||||||
|         uses: actions/checkout@v3 |         uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|       # Basic checkout using git |       # Basic checkout using git | ||||||
|       - name: Checkout basic |       - name: Checkout basic | ||||||
| @@ -205,3 +205,41 @@ jobs: | |||||||
|           path: basic |           path: basic | ||||||
|       - name: Verify basic |       - name: Verify basic | ||||||
|         run: __test__/verify-basic.sh --archive |         run: __test__/verify-basic.sh --archive | ||||||
|  |      | ||||||
|  |   test-git-container: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     container: bitnami/git:latest | ||||||
|  |     steps: | ||||||
|  |       # Clone this repo | ||||||
|  |       - name: Checkout | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           path: v3 | ||||||
|  |  | ||||||
|  |       # Basic checkout using git | ||||||
|  |       - name: Checkout basic | ||||||
|  |         uses: ./v3 | ||||||
|  |         with: | ||||||
|  |           ref: test-data/v2/basic | ||||||
|  |       - name: Verify basic | ||||||
|  |         run: | | ||||||
|  |           if [ ! -f "./basic-file.txt" ]; then | ||||||
|  |               echo "Expected basic file does not exist" | ||||||
|  |               exit 1 | ||||||
|  |           fi | ||||||
|  |  | ||||||
|  |           # Verify .git folder | ||||||
|  |           if [ ! -d "./.git" ]; then | ||||||
|  |             echo "Expected ./.git folder to exist" | ||||||
|  |             exit 1 | ||||||
|  |           fi | ||||||
|  |  | ||||||
|  |           # Verify auth token | ||||||
|  |           git config --global --add safe.directory "*" | ||||||
|  |           git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main | ||||||
|  |  | ||||||
|  |       # needed to make checkout post cleanup succeed | ||||||
|  |       - name: Fix Checkout v3 | ||||||
|  |         uses: actions/checkout@v3 | ||||||
|  |         with: | ||||||
|  |           path: v3 | ||||||
							
								
								
									
										2
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/node-fetch.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: node-fetch | name: node-fetch | ||||||
| version: 2.6.7 | version: 2.6.5 | ||||||
| type: npm | type: npm | ||||||
| summary: A light-weight module that brings window.fetch to node.js | summary: A light-weight module that brings window.fetch to node.js | ||||||
| homepage: https://github.com/bitinn/node-fetch | homepage: https://github.com/bitinn/node-fetch | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,17 +1,19 @@ | |||||||
| # Changelog | # Changelog | ||||||
|  |  | ||||||
| ## v3.0.1 | ## v2.5.0 | ||||||
| - [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) | - [Bump @actions/core to v1.10.0](https://github.com/actions/checkout/pull/962) | ||||||
| - [Bumped various npm package versions](https://github.com/actions/checkout/pull/744) |  | ||||||
|  |  | ||||||
| ## v3.0.0 | ## v2.4.2 | ||||||
|  | - [Add input `set-safe-directory`](https://github.com/actions/checkout/pull/776) | ||||||
|  |  | ||||||
| - [Update to node 16](https://github.com/actions/checkout/pull/689) | ## 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) | ||||||
|  |  | ||||||
| ## v2.3.1 | ## v2.3.1 | ||||||
|  |  | ||||||
| - [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284) | - [Fix default branch resolution for .wiki and when using SSH](https://github.com/actions/checkout/pull/284) | ||||||
|  |  | ||||||
|  |  | ||||||
| ## v2.3.0 | ## v2.3.0 | ||||||
|  |  | ||||||
| - [Fallback to the default branch](https://github.com/actions/checkout/pull/278) | - [Fallback to the default branch](https://github.com/actions/checkout/pull/278) | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								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> |   <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> | </p> | ||||||
|  |  | ||||||
| # Checkout V3 | # Checkout V2 | ||||||
|  |  | ||||||
| This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it. | This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it. | ||||||
|  |  | ||||||
| @@ -14,14 +14,27 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
|  |  | ||||||
| # What's new | # What's new | ||||||
|  |  | ||||||
| - Updated to the node16 runtime by default | - Improved performance | ||||||
|   - 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. |   - 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. | ||||||
|  |  | ||||||
| # Usage | # Usage | ||||||
|  |  | ||||||
| <!-- start usage --> | <!-- start usage --> | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/checkout@v3 | - uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     # Repository name with owner. For example, actions/checkout |     # Repository name with owner. For example, actions/checkout | ||||||
|     # Default: ${{ github.repository }} |     # Default: ${{ github.repository }} | ||||||
| @@ -92,6 +105,11 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
|     # |     # | ||||||
|     # Default: false |     # Default: false | ||||||
|     submodules: '' |     submodules: '' | ||||||
|  |  | ||||||
|  |     # Add repository path as safe.directory for Git global config by running `git | ||||||
|  |     # config --global --add safe.directory <path>` | ||||||
|  |     # Default: true | ||||||
|  |     set-safe-directory: '' | ||||||
| ``` | ``` | ||||||
| <!-- end usage --> | <!-- end usage --> | ||||||
|  |  | ||||||
| @@ -110,7 +128,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
| ## Fetch all history for all tags and branches | ## Fetch all history for all tags and branches | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/checkout@v3 | - uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     fetch-depth: 0 |     fetch-depth: 0 | ||||||
| ``` | ``` | ||||||
| @@ -118,7 +136,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
| ## Checkout a different branch | ## Checkout a different branch | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/checkout@v3 | - uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     ref: my-branch |     ref: my-branch | ||||||
| ``` | ``` | ||||||
| @@ -126,7 +144,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
| ## Checkout HEAD^ | ## Checkout HEAD^ | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/checkout@v3 | - uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     fetch-depth: 2 |     fetch-depth: 2 | ||||||
| - run: git checkout HEAD^ | - run: git checkout HEAD^ | ||||||
| @@ -136,12 +154,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Checkout | - name: Checkout | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     path: main |     path: main | ||||||
|  |  | ||||||
| - name: Checkout tools repo | - name: Checkout tools repo | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     repository: my-org/my-tools |     repository: my-org/my-tools | ||||||
|     path: my-tools |     path: my-tools | ||||||
| @@ -151,10 +169,10 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Checkout | - name: Checkout | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|  |  | ||||||
| - name: Checkout tools repo | - name: Checkout tools repo | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     repository: my-org/my-tools |     repository: my-org/my-tools | ||||||
|     path: my-tools |     path: my-tools | ||||||
| @@ -164,12 +182,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - name: Checkout | - name: Checkout | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     path: main |     path: main | ||||||
|  |  | ||||||
| - name: Checkout private tools | - name: Checkout private tools | ||||||
|   uses: actions/checkout@v3 |   uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     repository: my-org/my-private-tools |     repository: my-org/my-private-tools | ||||||
|     token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT |     token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT | ||||||
| @@ -182,7 +200,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl | |||||||
| ## Checkout pull request HEAD commit instead of merge commit | ## Checkout pull request HEAD commit instead of merge commit | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/checkout@v3 | - uses: actions/checkout@v2 | ||||||
|   with: |   with: | ||||||
|     ref: ${{ github.event.pull_request.head.sha }} |     ref: ${{ github.event.pull_request.head.sha }} | ||||||
| ``` | ``` | ||||||
| @@ -198,7 +216,7 @@ jobs: | |||||||
|   build: |   build: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v2 | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## Push a commit using the built-in token | ## Push a commit using the built-in token | ||||||
| @@ -209,7 +227,7 @@ jobs: | |||||||
|   build: |   build: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v2 | ||||||
|       - run: | |       - run: | | ||||||
|           date > generated.txt |           date > generated.txt | ||||||
|           git config user.name github-actions |           git config user.name github-actions | ||||||
|   | |||||||
| @@ -777,7 +777,8 @@ async function setup(testName: string): Promise<void> { | |||||||
|     sshKey: sshPath ? 'some ssh private key' : '', |     sshKey: sshPath ? 'some ssh private key' : '', | ||||||
|     sshKnownHosts: '', |     sshKnownHosts: '', | ||||||
|     sshStrict: true, |     sshStrict: true, | ||||||
|     workflowOrganizationId: 123456 |     workflowOrganizationId: 123456, | ||||||
|  |     setSafeDirectory: true | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -85,6 +85,7 @@ describe('input-helper tests', () => { | |||||||
|     expect(settings.repositoryName).toBe('some-repo') |     expect(settings.repositoryName).toBe('some-repo') | ||||||
|     expect(settings.repositoryOwner).toBe('some-owner') |     expect(settings.repositoryOwner).toBe('some-owner') | ||||||
|     expect(settings.repositoryPath).toBe(gitHubWorkspace) |     expect(settings.repositoryPath).toBe(gitHubWorkspace) | ||||||
|  |     expect(settings.setSafeDirectory).toBe(true) | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|   it('qualifies ref', async () => { |   it('qualifies ref', async () => { | ||||||
|   | |||||||
| @@ -68,7 +68,10 @@ inputs: | |||||||
|       When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are |       When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are | ||||||
|       converted to HTTPS. |       converted to HTTPS. | ||||||
|     default: false |     default: false | ||||||
|  |   set-safe-directory: | ||||||
|  |     description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>` | ||||||
|  |     default: true | ||||||
| runs: | runs: | ||||||
|   using: node16 |   using: node12 | ||||||
|   main: dist/index.js |   main: dist/index.js | ||||||
|   post: dist/index.js |   post: dist/index.js | ||||||
|   | |||||||
							
								
								
									
										2967
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2967
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										99
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										99
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -5,9 +5,28 @@ | |||||||
|   "requires": true, |   "requires": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@actions/core": { |     "@actions/core": { | ||||||
|       "version": "1.2.6", |       "version": "1.10.0", | ||||||
|       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", |       "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", | ||||||
|       "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" |       "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", | ||||||
|  |       "requires": { | ||||||
|  |         "@actions/http-client": "^2.0.1", | ||||||
|  |         "uuid": "^8.3.2" | ||||||
|  |       }, | ||||||
|  |       "dependencies": { | ||||||
|  |         "@actions/http-client": { | ||||||
|  |           "version": "2.0.1", | ||||||
|  |           "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", | ||||||
|  |           "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", | ||||||
|  |           "requires": { | ||||||
|  |             "tunnel": "^0.0.6" | ||||||
|  |           } | ||||||
|  |         }, | ||||||
|  |         "uuid": { | ||||||
|  |           "version": "8.3.2", | ||||||
|  |           "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", | ||||||
|  |           "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" | ||||||
|  |         } | ||||||
|  |       } | ||||||
|     }, |     }, | ||||||
|     "@actions/exec": { |     "@actions/exec": { | ||||||
|       "version": "1.0.1", |       "version": "1.0.1", | ||||||
| @@ -1929,6 +1948,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -3319,6 +3344,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -5377,6 +5408,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -7696,6 +7733,12 @@ | |||||||
|             "minimist": "^1.2.5" |             "minimist": "^1.2.5" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "semver": { |         "semver": { | ||||||
|           "version": "6.3.0", |           "version": "6.3.0", | ||||||
|           "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", |           "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", | ||||||
| @@ -9344,6 +9387,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -11359,6 +11408,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -12904,6 +12959,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -13658,6 +13719,12 @@ | |||||||
|             "picomatch": "^2.2.3" |             "picomatch": "^2.2.3" | ||||||
|           } |           } | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -14585,6 +14652,12 @@ | |||||||
|           "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", |           "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", | ||||||
|           "dev": true |           "dev": true | ||||||
|         }, |         }, | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         }, | ||||||
|         "normalize-path": { |         "normalize-path": { | ||||||
|           "version": "3.0.0", |           "version": "3.0.0", | ||||||
|           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |           "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", | ||||||
| @@ -15676,6 +15749,14 @@ | |||||||
|       "dev": true, |       "dev": true, | ||||||
|       "requires": { |       "requires": { | ||||||
|         "minimist": "^1.2.0" |         "minimist": "^1.2.0" | ||||||
|  |       }, | ||||||
|  |       "dependencies": { | ||||||
|  |         "minimist": { | ||||||
|  |           "version": "1.2.5", | ||||||
|  |           "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|  |           "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|  |           "dev": true | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "kleur": { |     "kleur": { | ||||||
| @@ -15872,9 +15953,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "minimist": { |     "minimist": { | ||||||
|       "version": "1.2.6", |       "version": "1.2.5", | ||||||
|       "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", |       "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", | ||||||
|       "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", |       "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", | ||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "ms": { |     "ms": { | ||||||
| @@ -15895,9 +15976,9 @@ | |||||||
|       "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" |       "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" | ||||||
|     }, |     }, | ||||||
|     "node-fetch": { |     "node-fetch": { | ||||||
|       "version": "2.6.7", |       "version": "2.6.5", | ||||||
|       "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", |       "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", | ||||||
|       "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", |       "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", | ||||||
|       "requires": { |       "requires": { | ||||||
|         "whatwg-url": "^5.0.0" |         "whatwg-url": "^5.0.0" | ||||||
|       }, |       }, | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ | |||||||
|   }, |   }, | ||||||
|   "homepage": "https://github.com/actions/checkout#readme", |   "homepage": "https://github.com/actions/checkout#readme", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@actions/core": "^1.2.6", |     "@actions/core": "^1.10.0", | ||||||
|     "@actions/exec": "^1.0.1", |     "@actions/exec": "^1.0.1", | ||||||
|     "@actions/github": "^2.2.0", |     "@actions/github": "^2.2.0", | ||||||
|     "@actions/io": "^1.0.1", |     "@actions/io": "^1.0.1", | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ export interface IGitAuthHelper { | |||||||
|   configureAuth(): Promise<void> |   configureAuth(): Promise<void> | ||||||
|   configureGlobalAuth(): Promise<void> |   configureGlobalAuth(): Promise<void> | ||||||
|   configureSubmoduleAuth(): Promise<void> |   configureSubmoduleAuth(): Promise<void> | ||||||
|   configureTempGlobalConfig(repositoryPath?: string): Promise<string> |   configureTempGlobalConfig(): Promise<string> | ||||||
|   removeAuth(): Promise<void> |   removeAuth(): Promise<void> | ||||||
|   removeGlobalConfig(): Promise<void> |   removeGlobalConfig(): Promise<void> | ||||||
| } | } | ||||||
| @@ -81,7 +81,7 @@ class GitAuthHelper { | |||||||
|     await this.configureToken() |     await this.configureToken() | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   async configureTempGlobalConfig(repositoryPath?: string): Promise<string> { |   async configureTempGlobalConfig(): Promise<string> { | ||||||
|     // Already setup global config |     // Already setup global config | ||||||
|     if (this.temporaryHomePath?.length > 0) { |     if (this.temporaryHomePath?.length > 0) { | ||||||
|       return path.join(this.temporaryHomePath, '.gitconfig') |       return path.join(this.temporaryHomePath, '.gitconfig') | ||||||
| @@ -121,21 +121,6 @@ class GitAuthHelper { | |||||||
|     ) |     ) | ||||||
|     this.git.setEnvironmentVariable('HOME', this.temporaryHomePath) |     this.git.setEnvironmentVariable('HOME', this.temporaryHomePath) | ||||||
|  |  | ||||||
|     // Setup the workspace as a safe directory, so if we pass this into a container job with a different user it doesn't fail |  | ||||||
|     // Otherwise all git commands we run in a container fail |  | ||||||
|     core.info( |  | ||||||
|       `Adding working directory to the temporary git global config as a safe directory` |  | ||||||
|     ) |  | ||||||
|     await this.git |  | ||||||
|       .config( |  | ||||||
|         'safe.directory', |  | ||||||
|         repositoryPath ?? this.settings.repositoryPath, |  | ||||||
|         true, |  | ||||||
|         true |  | ||||||
|       ) |  | ||||||
|       .catch(error => { |  | ||||||
|         core.info(`Failed to initialize safe directory with error: ${error}`) |  | ||||||
|       }) |  | ||||||
|     return newGitConfigPath |     return newGitConfigPath | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,7 +40,24 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> { | |||||||
|   try { |   try { | ||||||
|     if (git) { |     if (git) { | ||||||
|       authHelper = gitAuthHelper.createAuthHelper(git, settings) |       authHelper = gitAuthHelper.createAuthHelper(git, settings) | ||||||
|       await authHelper.configureTempGlobalConfig() |       if (settings.setSafeDirectory) { | ||||||
|  |         // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail | ||||||
|  |         // Otherwise all git commands we run in a container fail | ||||||
|  |         await authHelper.configureTempGlobalConfig() | ||||||
|  |         core.info( | ||||||
|  |           `Adding repository directory to the temporary git global config as a safe directory` | ||||||
|  |         ) | ||||||
|  |  | ||||||
|  |         await git | ||||||
|  |           .config('safe.directory', settings.repositoryPath, true, true) | ||||||
|  |           .catch(error => { | ||||||
|  |             core.info( | ||||||
|  |               `Failed to initialize safe directory with error: ${error}` | ||||||
|  |             ) | ||||||
|  |           }) | ||||||
|  |  | ||||||
|  |         stateHelper.setSafeDirectory() | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Prepare existing directory, otherwise recreate |     // Prepare existing directory, otherwise recreate | ||||||
| @@ -249,7 +266,21 @@ export async function cleanup(repositoryPath: string): Promise<void> { | |||||||
|   // Remove auth |   // Remove auth | ||||||
|   const authHelper = gitAuthHelper.createAuthHelper(git) |   const authHelper = gitAuthHelper.createAuthHelper(git) | ||||||
|   try { |   try { | ||||||
|     await authHelper.configureTempGlobalConfig(repositoryPath) |     if (stateHelper.PostSetSafeDirectory) { | ||||||
|  |       // Setup the repository path as a safe directory, so if we pass this into a container job with a different user it doesn't fail | ||||||
|  |       // Otherwise all git commands we run in a container fail | ||||||
|  |       await authHelper.configureTempGlobalConfig() | ||||||
|  |       core.info( | ||||||
|  |         `Adding repository directory to the temporary git global config as a safe directory` | ||||||
|  |       ) | ||||||
|  |  | ||||||
|  |       await git | ||||||
|  |         .config('safe.directory', repositoryPath, true, true) | ||||||
|  |         .catch(error => { | ||||||
|  |           core.info(`Failed to initialize safe directory with error: ${error}`) | ||||||
|  |         }) | ||||||
|  |     } | ||||||
|  |  | ||||||
|     await authHelper.removeAuth() |     await authHelper.removeAuth() | ||||||
|   } finally { |   } finally { | ||||||
|     await authHelper.removeGlobalConfig() |     await authHelper.removeGlobalConfig() | ||||||
|   | |||||||
| @@ -78,4 +78,9 @@ export interface IGitSourceSettings { | |||||||
|    * Organization ID for the currently running workflow (used for auth settings) |    * Organization ID for the currently running workflow (used for auth settings) | ||||||
|    */ |    */ | ||||||
|   workflowOrganizationId: number | undefined |   workflowOrganizationId: number | undefined | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * Indicates whether to add repositoryPath as safe.directory in git global config | ||||||
|  |    */ | ||||||
|  |   setSafeDirectory: boolean | ||||||
| } | } | ||||||
|   | |||||||
| @@ -122,5 +122,8 @@ export async function getInputs(): Promise<IGitSourceSettings> { | |||||||
|   // Workflow organization ID |   // Workflow organization ID | ||||||
|   result.workflowOrganizationId = await workflowContextHelper.getOrganizationId() |   result.workflowOrganizationId = await workflowContextHelper.getOrganizationId() | ||||||
|  |  | ||||||
|  |   // Set safe.directory in git global config. | ||||||
|  |   result.setSafeDirectory = | ||||||
|  |     (core.getInput('set-safe-directory') || 'true').toUpperCase() === 'TRUE' | ||||||
|   return result |   return result | ||||||
| } | } | ||||||
|   | |||||||
| @@ -120,7 +120,7 @@ function updateUsage( | |||||||
| } | } | ||||||
|  |  | ||||||
| updateUsage( | updateUsage( | ||||||
|   'actions/checkout@v3', |   'actions/checkout@v2', | ||||||
|   path.join(__dirname, '..', '..', 'action.yml'), |   path.join(__dirname, '..', '..', 'action.yml'), | ||||||
|   path.join(__dirname, '..', '..', 'README.md') |   path.join(__dirname, '..', '..', 'README.md') | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -5,4 +5,4 @@ set -e | |||||||
| src/misc/licensed-download.sh | src/misc/licensed-download.sh | ||||||
|  |  | ||||||
| echo 'Running: licensed cached' | echo 'Running: licensed cached' | ||||||
| _temp/licensed-3.6.0/licensed status | _temp/licensed-3.3.1/licensed status | ||||||
| @@ -2,23 +2,23 @@ | |||||||
|  |  | ||||||
| set -e | set -e | ||||||
|  |  | ||||||
| if [ ! -f _temp/licensed-3.6.0.done ]; then | if [ ! -f _temp/licensed-3.3.1.done ]; then | ||||||
|   echo 'Clearing temp' |   echo 'Clearing temp' | ||||||
|   rm -rf _temp/licensed-3.6.0 || true |   rm -rf _temp/licensed-3.3.1 || true | ||||||
|  |  | ||||||
|   echo 'Downloading licensed' |   echo 'Downloading licensed' | ||||||
|   mkdir -p _temp/licensed-3.6.0 |   mkdir -p _temp/licensed-3.3.1 | ||||||
|   pushd _temp/licensed-3.6.0 |   pushd _temp/licensed-3.3.1 | ||||||
|   if [[ "$OSTYPE" == "darwin"* ]]; then |   if [[ "$OSTYPE" == "darwin"* ]]; then | ||||||
|     curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.6.0/licensed-3.6.0-darwin-x64.tar.gz |     curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-darwin-x64.tar.gz | ||||||
|   else |   else | ||||||
|     curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.6.0/licensed-3.6.0-linux-x64.tar.gz |     curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   echo 'Extracting licenesed' |   echo 'Extracting licenesed' | ||||||
|   tar -xzf licensed.tar.gz |   tar -xzf licensed.tar.gz | ||||||
|   popd |   popd | ||||||
|   touch _temp/licensed-3.6.0.done |   touch _temp/licensed-3.3.1.done | ||||||
| else | else | ||||||
|   echo 'Licensed already downloaded' |   echo 'Licensed already downloaded' | ||||||
| fi | fi | ||||||
|   | |||||||
| @@ -5,4 +5,4 @@ set -e | |||||||
| src/misc/licensed-download.sh | src/misc/licensed-download.sh | ||||||
|  |  | ||||||
| echo 'Running: licensed cached' | echo 'Running: licensed cached' | ||||||
| _temp/licensed-3.6.0/licensed cache | _temp/licensed-3.3.1/licensed cache | ||||||
| @@ -1,58 +1,60 @@ | |||||||
| import * as coreCommand from '@actions/core/lib/command' | import * as core from '@actions/core' | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Indicates whether the POST action is running |  * Indicates whether the POST action is running | ||||||
|  */ |  */ | ||||||
| export const IsPost = !!process.env['STATE_isPost'] | export const IsPost = !!core.getState('isPost') | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The repository path for the POST action. The value is empty during the MAIN action. |  * The repository path for the POST action. The value is empty during the MAIN action. | ||||||
|  */ |  */ | ||||||
| export const RepositoryPath = | export const RepositoryPath = core.getState('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' | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The SSH key path for the POST action. The value is empty during the MAIN action. |  * The SSH key path for the POST action. The value is empty during the MAIN action. | ||||||
|  */ |  */ | ||||||
| export const SshKeyPath = (process.env['STATE_sshKeyPath'] as string) || '' | export const SshKeyPath = core.getState('sshKeyPath') | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The SSH known hosts path for the POST action. The value is empty during the MAIN action. |  * The SSH known hosts path for the POST action. The value is empty during the MAIN action. | ||||||
|  */ |  */ | ||||||
| export const SshKnownHostsPath = | export const SshKnownHostsPath = core.getState('sshKnownHostsPath') | ||||||
|   (process.env['STATE_sshKnownHostsPath'] as string) || '' |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Save the repository path so the POST action can retrieve the value. |  * Save the repository path so the POST action can retrieve the value. | ||||||
|  */ |  */ | ||||||
| export function setRepositoryPath(repositoryPath: string) { | export function setRepositoryPath(repositoryPath: string) { | ||||||
|   coreCommand.issueCommand( |   core.saveState('repositoryPath', repositoryPath) | ||||||
|     'save-state', |  | ||||||
|     {name: 'repositoryPath'}, |  | ||||||
|     repositoryPath |  | ||||||
|   ) |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Save the SSH key path so the POST action can retrieve the value. |  * Save the SSH key path so the POST action can retrieve the value. | ||||||
|  */ |  */ | ||||||
| export function setSshKeyPath(sshKeyPath: string) { | export function setSshKeyPath(sshKeyPath: string) { | ||||||
|   coreCommand.issueCommand('save-state', {name: 'sshKeyPath'}, sshKeyPath) |   core.saveState('sshKeyPath', sshKeyPath) | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Save the SSH known hosts path so the POST action can retrieve the value. |  * Save the SSH known hosts path so the POST action can retrieve the value. | ||||||
|  */ |  */ | ||||||
| export function setSshKnownHostsPath(sshKnownHostsPath: string) { | export function setSshKnownHostsPath(sshKnownHostsPath: string) { | ||||||
|   coreCommand.issueCommand( |   core.saveState('sshKnownHostsPath', sshKnownHostsPath) | ||||||
|     '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') | ||||||
| } | } | ||||||
|  |  | ||||||
| // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic. | // 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. | // This is necessary since we don't have a separate entry point. | ||||||
| if (!IsPost) { | if (!IsPost) { | ||||||
|   coreCommand.issueCommand('save-state', {name: 'isPost'}, 'true') |   core.saveState('isPost', 'true') | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user