fix(prototyper): validate pmu firmware counter index (#191) #8
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: Changelog | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| CARGO_UNSTABLE_SPARSE_REGISTRY: true | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check-changelogs: | |
| name: Check changelogs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # 需要完整提交历史来比较差异 | |
| - name: Get changed files | |
| run: | | |
| # 获取基准和当前提交的差异文件列表 | |
| git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changed_files.txt | |
| - name: Validate changes | |
| run: | | |
| # 需要检查的目录数组 | |
| directories=( | |
| "library/sbi-rt" | |
| "library/sbi-spec" | |
| "library/sbi-testing" | |
| "library/rustsbi" | |
| "library/macros" | |
| ) | |
| exit_code=0 | |
| while IFS= read -r file; do | |
| for dir in "${directories[@]}"; do | |
| # 检查文件是否属于当前目录 | |
| if [[ "$file" == "$dir/"* ]]; then | |
| # 检查对应的CHANGELOG是否被修改 | |
| if ! grep -q "^$dir/CHANGELOG.md" changed_files.txt; then | |
| echo "::error file=$dir/CHANGELOG.md::Detected changes in $dir but the corresponding CHANGELOG.md was not updated" | |
| exit_code=1 | |
| else | |
| echo "CHANGELOG.md updated for $dir file changes." | |
| fi | |
| break # 已匹配目录,跳出内层循环 | |
| fi | |
| done | |
| done < changed_files.txt | |
| exit $exit_code |