brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 441f949 Raw
65 lines · yaml
1name: "Check code formatting"2 3permissions:4  contents: read5 6on:7  pull_request:8    branches:9      - main10      - 'users/**'11 12jobs:13  code_formatter:14    runs-on: ubuntu-24.0415    container:16      image: 'ghcr.io/llvm/ci-ubuntu-24.04-format'17    timeout-minutes: 3018    concurrency:19      group: ${{ github.workflow }}-${{ github.event.pull_request.number }}20      cancel-in-progress: true21    if: github.repository == 'llvm/llvm-project'22    steps:23      - name: Fetch LLVM sources24        uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.025        with:26          fetch-depth: 227 28      - name: Get changed files29        id: changed-files30        uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.031        with:32          separator: ","33          skip_initial_fetch: true34          base_sha: 'HEAD~1'35          sha: 'HEAD'36 37      - name: "Listed files"38        env:39          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}40        run: |41          echo "Formatting files:"42          echo "$CHANGED_FILES"43 44      - name: Run code formatter45        env:46          GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}47          CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}48        # Create an empty comments file so the pr-write job doesn't fail.49        run: |50          echo "[]" > comments &&51          python ./llvm/utils/git/code-format-helper.py \52            --write-comment-to-file \53            --token ${{ secrets.GITHUB_TOKEN }} \54            --issue-number $GITHUB_PR_NUMBER \55            --start-rev HEAD~1 \56            --end-rev HEAD \57            --changed-files "$CHANGED_FILES"58 59      - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.060        if: always()61        with:62          name: workflow-args63          path: |64            comments65