Skip to content

Commit b30b9a1

Browse files
[Github] Remove separate tools checkout from pr-code workflows
These separate checkouts I believe were originally carried over from when we were using pull_request_target. We needed two checkouts to ensure we were not executing user supplied code. We kept them to ensure we were using the latest version of the tools, but this was born mostly out of a misunderstanding of how Github Actions works. All PRs directly against main are executed as if merged into main, so already are using the latest version of the tools no matter the branch point. Stacked PRs still need to be rebased for changes to propagate but these files have been pretty stable for the past two years or so and I can't imagine any changes needed to keep things running on release/stacked PR branches.
1 parent 7d748a9 commit b30b9a1

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,6 @@ jobs:
3232
base_sha: 'HEAD~1'
3333
sha: 'HEAD'
3434

35-
# We need to pull the script from the main branch, so that we ensure
36-
# we get the latest version of this script.
37-
- name: Fetch code formatting utils
38-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
39-
with:
40-
repository: ${{ github.repository }}
41-
ref: ${{ github.base_ref }}
42-
sparse-checkout: |
43-
llvm/utils/git/requirements_formatting.txt
44-
llvm/utils/git/code-format-helper.py
45-
sparse-checkout-cone-mode: false
46-
path: code-format-tools
47-
4835
- name: "Listed files"
4936
env:
5037
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
@@ -65,10 +52,10 @@ jobs:
6552
with:
6653
python-version: '3.11'
6754
cache: 'pip'
68-
cache-dependency-path: 'code-format-tools/llvm/utils/git/requirements_formatting.txt'
55+
cache-dependency-path: 'llvm/utils/git/requirements_formatting.txt'
6956

7057
- name: Install python dependencies
71-
run: pip install -r code-format-tools/llvm/utils/git/requirements_formatting.txt
58+
run: pip install -r llvm/utils/git/requirements_formatting.txt
7259

7360
- name: Run code formatter
7461
env:
@@ -77,7 +64,7 @@ jobs:
7764
# Create an empty comments file so the pr-write job doesn't fail.
7865
run: |
7966
echo "[]" > comments &&
80-
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
67+
python ./llvm/utils/git/code-format-helper.py \
8168
--write-comment-to-file \
8269
--token ${{ secrets.GITHUB_TOKEN }} \
8370
--issue-number $GITHUB_PR_NUMBER \

.github/workflows/pr-code-lint.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ jobs:
4545
run: |
4646
echo "Changed files:"
4747
echo "$CHANGED_FILES"
48-
49-
- name: Fetch code linting utils
50-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
51-
with:
52-
repository: ${{ github.repository }}
53-
ref: ${{ github.base_ref }}
54-
sparse-checkout: |
55-
llvm/utils/git/code-lint-helper.py
56-
llvm/utils/git/requirements_linting.txt
57-
clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
58-
sparse-checkout-cone-mode: false
59-
path: code-lint-tools
6048
6149
- name: Install clang-tidy
6250
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
@@ -69,7 +57,7 @@ jobs:
6957
python-version: '3.12'
7058

7159
- name: Install Python dependencies
72-
run: python3 -m pip install -r code-lint-tools/llvm/utils/git/requirements_linting.txt
60+
run: python3 -m pip install -r llvm/utils/git/requirements_linting.txt
7361

7462
# TODO: create special mapping for 'codegen' targets, for now build predefined set
7563
# TODO: add entrypoint in 'compute_projects.py' that only adds a project and its direct dependencies
@@ -106,7 +94,7 @@ jobs:
10694
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
10795
run: |
10896
echo "[]" > comments &&
109-
python3 ./code-lint-tools/llvm/utils/git/code-lint-helper.py \
97+
python3 llvm/utils/git/code-lint-helper.py \
11098
--token ${{ secrets.GITHUB_TOKEN }} \
11199
--issue-number $GITHUB_PR_NUMBER \
112100
--start-rev HEAD~1 \

0 commit comments

Comments
 (0)