Partially reinstate CI formatting process (#15155)
* Partially reinstate CI formatting process * Fix exit code on clean run * Fix exit code on clean run
This commit is contained in:
		
							parent
							
								
									b785305080
								
							
						
					
					
						commit
						ec0bb791f8
					
				
					 2 changed files with 58 additions and 21 deletions
				
			
		
							
								
								
									
										21
									
								
								.github/workflows/format.yaml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								.github/workflows/format.yaml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -19,7 +19,9 @@ jobs:
 | 
			
		|||
    container: qmkfm/qmk_cli
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: rlespinasse/github-slug-action@v3.x
 | 
			
		||||
    - name: Install dependencies
 | 
			
		||||
      run: |
 | 
			
		||||
        apt-get update && apt-get install -y dos2unix
 | 
			
		||||
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
      with:
 | 
			
		||||
| 
						 | 
				
			
			@ -31,12 +33,17 @@ jobs:
 | 
			
		|||
        output: ' '
 | 
			
		||||
        fileOutput: ' '
 | 
			
		||||
 | 
			
		||||
    - name: Run qmk format-c and qmk format-python
 | 
			
		||||
    - name: Run qmk formatters
 | 
			
		||||
      shell: 'bash {0}'
 | 
			
		||||
      run: |
 | 
			
		||||
        qmk format-c --core-only -n $(< ~/files.txt)
 | 
			
		||||
        format_c_exit=$?
 | 
			
		||||
        qmk format-python -n
 | 
			
		||||
        format_python_exit=$?
 | 
			
		||||
        qmk format-c --core-only $(< ~/files.txt)
 | 
			
		||||
        qmk format-python
 | 
			
		||||
        qmk format-text $(< ~/files.txt)
 | 
			
		||||
        git diff
 | 
			
		||||
 | 
			
		||||
        exit $((format_c_exit + format_python_exit))
 | 
			
		||||
    - name: Fail when formatting required
 | 
			
		||||
      run: |
 | 
			
		||||
        for file in $(git diff --name-only); do
 | 
			
		||||
          echo "::error file=${file}::::File Requires Formatting"
 | 
			
		||||
        done
 | 
			
		||||
        test -z "$(git diff --name-only)"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue