fix: permissions in github actions (#2906) #8650
This file contains 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: Awesome CI Workflow | |
on: [push, pull_request] | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
MainSequence: | |
name: Code Formatter | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cpp-linter/cpp-linter-action@v2 | |
id: linter | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
style: "file" | |
tidy-checks: ".clang-tidy" | |
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }} | |
build: | |
name: Compile checks | |
runs-on: ${{ matrix.os }} | |
needs: [MainSequence] | |
permissions: | |
pull-requests: write | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: GCC problem matcher | |
uses: ammaraskar/[email protected] | |
- run: | | |
cmake -B ./build -S . | |
cmake --build build --parallel 4 | |
- name: Label on PR fail | |
uses: actions/github-script@v6 | |
if: ${{ failure() && matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['automated tests are failing'] | |
}) |