| 
									
										
										
										
											2020-02-13 12:38:56 -05:00
										 |  |  | #!/bin/sh
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Validate args | 
					
						
							|  |  |  | prefix="$1" | 
					
						
							|  |  |  | if [ -z "$prefix" ]; then | 
					
						
							|  |  |  |   echo "Must supply prefix argument" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-07 23:30:01 -04:00
										 |  |  | path="$2" | 
					
						
							|  |  |  | if [ -z "$path" ]; then | 
					
						
							|  |  |  |   echo "Must specify path argument" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-13 12:38:56 -05:00
										 |  |  | # Sanity check GITHUB_RUN_ID defined | 
					
						
							|  |  |  | if [ -z "$GITHUB_RUN_ID" ]; then | 
					
						
							|  |  |  |   echo "GITHUB_RUN_ID not defined" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Verify file exists | 
					
						
							| 
									
										
										
										
											2020-04-07 23:30:01 -04:00
										 |  |  | file="$path/test-file.txt" | 
					
						
							| 
									
										
										
										
											2020-02-13 12:38:56 -05:00
										 |  |  | echo "Checking for $file" | 
					
						
							|  |  |  | if [ ! -e $file ]; then | 
					
						
							|  |  |  |   echo "File does not exist" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Verify file content | 
					
						
							|  |  |  | content="$(cat $file)" | 
					
						
							|  |  |  | echo "File content:\n$content" | 
					
						
							|  |  |  | if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then | 
					
						
							|  |  |  |   echo "Unexpected file content" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							| 
									
										
										
										
											2020-04-07 23:30:01 -04:00
										 |  |  | fi |