Update provisioning tooling and libraries from main #235
Workflow file for this run
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: Prevent Provision Directory Changes | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - 'release_*' | |
| jobs: | |
| verify-changed-files: | |
| if: ${{ github.actor != 'silabs-matter-ci-bot[bot]' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Get list of changed files and check for unauthorized changes | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const { data: commits } = await github.rest.pulls.listCommits({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.payload.pull_request.number | |
| }); | |
| let unauthorizedChanges = false; | |
| for (const commit of commits) { | |
| const { data: files } = await github.rest.repos.getCommit({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: commit.sha | |
| }); | |
| const changedFiles = files.files.map(file => file.filename); | |
| console.log(`Changed files in commit ${commit.sha}:`, changedFiles); | |
| if (files.files.some(file => | |
| (file.filename.startsWith('provision/libs/') || file.filename.startsWith('provision/headers/')) && | |
| (file.additions > 0 || file.deletions > 0 || file.status === 'added' || file.status === 'removed') && | |
| commit.author.login !== 'github-actions[bot]' | |
| )) { | |
| unauthorizedChanges = true; | |
| console.log(`Unauthorized changes detected in the provision directory by ${commit.author.login} in commit ${commit.sha}`); | |
| } | |
| } | |
| if (unauthorizedChanges) { | |
| core.setFailed('Unauthorized changes detected in the provision directory.'); | |
| } |