- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| # This action requires that any PR targeting the master branch should touch at
 | |
| # least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip
 | |
| # Changelog" label to disable this action.
 | |
| 
 | |
| name: changelog
 | |
| 
 | |
| on:
 | |
|   pull_request:
 | |
|     types: [opened, synchronize, reopened, labeled, unlabeled]
 | |
|     branches:
 | |
|       - develop
 | |
| 
 | |
| permissions:
 | |
|   contents: read
 | |
| 
 | |
| jobs:
 | |
|   changelog:
 | |
|     runs-on: ubuntu-latest
 | |
|     if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
 | |
| 
 | |
|     steps:
 | |
|       - uses: actions/checkout@v2
 | |
| 
 | |
|       - name: Check for CHANGELOG changes
 | |
|         run: |
 | |
|           # Only the latest commit of the feature branch is available
 | |
|           # automatically. To diff with the base branch, we need to
 | |
|           # fetch that too (and we only need its latest commit).
 | |
|           git fetch origin ${{ github.base_ref }} --depth=1
 | |
|           if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]]
 | |
|           then
 | |
|             echo "A CHANGELOG was modified. Looks good!"
 | |
|           else
 | |
|             echo "No CHANGELOG was modified."
 | |
|             echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required."
 | |
|             false
 | |
|           fi |