mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
Revert "[Github] Fetch all commits in PR for code formatting checks (#69766)"
This reverts commit 4aa12afb96.
This change introduced failures upon checking out the PR source code.
Pulling this out of tree while I investigate further.
This commit is contained in:
46
.github/workflows/pr-code-format.yml
vendored
46
.github/workflows/pr-code-format.yml
vendored
@@ -7,37 +7,17 @@ jobs:
|
||||
code_formatter:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Get changed files before checking out the repository to force the action
|
||||
# to analyze the diff from the Github API rather than looking at the
|
||||
# shallow clone and erroring out, which is significantly more prone to
|
||||
# failure.
|
||||
- name: Fetch LLVM sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v39
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
- name: Calculate number of commits to fetch
|
||||
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Fetch PR sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
|
||||
path: pr-sources
|
||||
|
||||
# We need to make sure that we aren't executing/using any code from the
|
||||
# PR for security reasons as we're using pull_request_target. Checkout
|
||||
# the target branch with the necessary files.
|
||||
- name: Fetch LLVM Sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
llvm/utils/git/requirements_formatting.txt
|
||||
llvm/utils/git/code-format-helper.py
|
||||
sparse-checkout-cone-mode: false
|
||||
path: llvm-sources
|
||||
fetch_depth: 100 # Fetches only the last 10 commits
|
||||
|
||||
- name: "Listed files"
|
||||
run: |
|
||||
@@ -54,21 +34,21 @@ jobs:
|
||||
with:
|
||||
python-version: '3.11'
|
||||
cache: 'pip'
|
||||
cache-dependency-path: 'llvm-sources/llvm/utils/git/requirements_formatting.txt'
|
||||
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
|
||||
|
||||
- name: Install python dependencies
|
||||
run: pip install -r llvm-sources/llvm/utils/git/requirements_formatting.txt
|
||||
run: pip install -r llvm/utils/git/requirements_formatting.txt
|
||||
|
||||
- name: Run code formatter
|
||||
env:
|
||||
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PR_DEPTH: ${{ github.event.pull_request.commits }}
|
||||
START_REV: ${{ github.event.pull_request.base.sha }}
|
||||
END_REV: ${{ github.event.pull_request.head.sha }}
|
||||
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
|
||||
working-directory: ./pr-sources
|
||||
run: |
|
||||
python ../llvm-sources/llvm/utils/git/code-format-helper.py \
|
||||
python llvm/utils/git/code-format-helper.py \
|
||||
--token ${{ secrets.GITHUB_TOKEN }} \
|
||||
--issue-number $GITHUB_PR_NUMBER \
|
||||
--start-rev HEAD~$PR_DEPTH \
|
||||
--end-rev HEAD \
|
||||
--start-rev $START_REV \
|
||||
--end-rev $END_REV \
|
||||
--changed-files "$CHANGED_FILES"
|
||||
|
||||
Reference in New Issue
Block a user