diff --git a/.github/actions/checkout-baseline-tooling/action.yml b/.github/actions/checkout-baseline-tooling/action.yml new file mode 100644 index 0000000000000..033c7d7d9c1db --- /dev/null +++ b/.github/actions/checkout-baseline-tooling/action.yml @@ -0,0 +1,17 @@ +name: Checkout Baseline Tooling +description: >- + Checkout the baseline tooling scripts prior to running any pre-commit hooks + or other GH action or workflow scripts. + +runs: + using: composite + steps: + - uses: llvm/llvm-project/.github/actions/checkout-baseline-tooling@main + with: + persist-credentials: false + sparse-checkout: | + llvm/utils/git/ + .ci/ + .github/ + ref: main + path: baseline-scripts diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 9841301f32a2d..ef6fac649e181 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -26,6 +26,9 @@ jobs: persist-credentials: false fetch-depth: 2 + - name: Checkout Baseline Tooling + uses: llvm/llvm-project/.github/actions/checkout-baseline-tooling@main + - name: Get changed files id: changed-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 @@ -49,10 +52,10 @@ jobs: # Create an empty comments file so the pr-write job doesn't fail. run: | echo "[]" > comments && - python ./llvm/utils/git/code-format-helper.py \ + python ./baseline-scripts/llvm/utils/git/code-format-helper.py \ --write-comment-to-file \ --token ${{ secrets.GITHUB_TOKEN }} \ - --issue-number $GITHUB_PR_NUMBER \ + --issue-number "$GITHUB_PR_NUMBER" \ --start-rev HEAD~1 \ --end-rev HEAD \ --changed-files "$CHANGED_FILES" diff --git a/.github/workflows/pr-code-lint.yml b/.github/workflows/pr-code-lint.yml index 5101db3ca7612..f37ddb69b0080 100644 --- a/.github/workflows/pr-code-lint.yml +++ b/.github/workflows/pr-code-lint.yml @@ -33,6 +33,9 @@ jobs: persist-credentials: false fetch-depth: 2 + - name: Checkout Baseline Tooling + uses: llvm/llvm-project/.github/actions/checkout-baseline-tooling@main + - name: Get changed files id: changed-files uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 @@ -55,7 +58,7 @@ jobs: run: | git config --global --add safe.directory '*' - . <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py) + . <(git diff --name-only HEAD~1...HEAD | python3 ./baseline-scripts/.ci/compute_projects.py) if [[ "${projects_to_build}" == "" ]]; then echo "No projects to analyze" @@ -91,7 +94,7 @@ jobs: CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | echo "[]" > comments && - python3 llvm/utils/git/code-lint-helper.py \ + python3 ./baseline-scripts/llvm/utils/git/code-lint-helper.py \ --token ${{ secrets.GITHUB_TOKEN }} \ --issue-number $GITHUB_PR_NUMBER \ --start-rev HEAD~1 \