[StepSecurity] Apply security best practices #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "tj-action changed-files incident" | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| pull-requests: read | |
| jobs: | |
| changed_files: | |
| runs-on: ubuntu-latest | |
| name: Test changed-files | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| # Example 1 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: step-security/changed-files@95b56dadb92a30ca9036f16423fd3c088a71ee94 # v46.0.5 | |
| - name: List all changed files | |
| run: | | |
| for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
| echo "$file was changed" | |
| done |