Skip to content

Commit caa5971

Browse files
authoredMar 27, 2025··
ci(workflows): Lock actions to commits and improve readability (#11147)
* Revert "ci(actions): Replace changed-files (#11130)" This reverts commit ba2ab1e. * ci(workflows): Lock actions to commits and improve readability
1 parent 98611d4 commit caa5971

23 files changed

+199
-227
lines changed
 

‎.github/scripts/set_push_chunks.sh

+3-90
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,6 @@
22

33
build_all=false
44
chunks_count=0
5-
last_check_files=""
6-
last_check_result=""
7-
gh_output=""
8-
9-
# Define the file patterns
10-
core_files=(
11-
'\.github/.*'
12-
'cores/.*'
13-
'package/.*'
14-
'tools/.*'
15-
'platform\.txt'
16-
'programmers\.txt'
17-
'variants/esp32/.*'
18-
'variants/esp32c3/.*'
19-
'variants/esp32c6/.*'
20-
'variants/esp32h2/.*'
21-
'variants/esp32p4/.*'
22-
'variants/esp32s2/.*'
23-
'variants/esp32s3/.*'
24-
)
25-
library_files=(
26-
'libraries/.*/examples/.*'
27-
'libraries/.*/src/.*'
28-
)
29-
networking_files=(
30-
'libraries/Network/src/.*'
31-
)
32-
fs_files=(
33-
'libraries/FS/src/.*'
34-
)
35-
static_sketches_files=(
36-
'libraries/NetworkClientSecure/examples/WiFiClientSecure/WiFiClientSecure\.ino'
37-
'libraries/BLE/examples/Server/Server\.ino'
38-
'libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer\.ino'
39-
'libraries/Insights/examples/MinimalDiagnostics/MinimalDiagnostics\.ino'
40-
'libraries/NetworkClientSecure/src/.*'
41-
'libraries/BLE/src/.*'
42-
'libraries/Insights/src/.*'
43-
)
44-
idf_files=(
45-
'idf_component\.yml'
46-
'Kconfig\.projbuild'
47-
'CMakeLists\.txt'
48-
'variants/esp32c2/.*'
49-
)
50-
51-
# Function to check if any files match the patterns
52-
check_files() {
53-
local patterns=("$@")
54-
local files_found=""
55-
for pattern in "${patterns[@]}"; do
56-
echo "Checking pattern: $pattern"
57-
matched_files=$(echo "$gh_output" | grep -E "$pattern")
58-
echo "matched_files: $matched_files"
59-
files_found+="$matched_files "
60-
done
61-
62-
last_check_files=$(echo "$files_found" | xargs)
63-
if [[ -n $last_check_files ]]; then
64-
last_check_result="true"
65-
else
66-
last_check_result="false"
67-
fi
68-
echo "last_check_result: $last_check_result"
69-
}
70-
71-
if [[ $IS_PR != 'true' ]]; then
72-
gh_output=$(gh api repos/espressif/arduino-esp32/commits/"$GITHUB_SHA" --jq '.files[].filename')
73-
else
74-
gh_output=$(gh pr diff "$PR_NUM" --name-only)
75-
fi
76-
echo "gh_output: $gh_output"
77-
78-
# Output the results
79-
check_files "${core_files[@]}"
80-
CORE_CHANGED=$last_check_result
81-
check_files "${library_files[@]}"
82-
LIB_CHANGED=$last_check_result
83-
LIB_FILES=$last_check_files
84-
check_files "${networking_files[@]}"
85-
NETWORKING_CHANGED=$last_check_result
86-
check_files "${fs_files[@]}"
87-
FS_CHANGED=$last_check_result
88-
check_files "${static_sketches_files[@]}"
89-
STATIC_SKETCHES_CHANGED=$last_check_result
90-
check_files "${idf_files[@]}"
91-
IDF_CHANGED=$last_check_result
925

936
if [[ $CORE_CHANGED == 'true' ]] || [[ $IS_PR != 'true' ]]; then
947
echo "Core files changed or not a PR. Building all."
@@ -163,9 +76,9 @@ chunks+="]"
16376

16477
{
16578
echo "build_all=$build_all"
166-
echo "build_libraries=$LIB_CHANGED"
167-
echo "build_static_sketches=$STATIC_SKETCHES_CHANGED"
168-
echo "build_idf=$IDF_CHANGED"
79+
echo "build_libraries=$BUILD_LIBRARIES"
80+
echo "build_static_sketches=$BUILD_STATIC_SKETCHES"
81+
echo "build_idf=$BUILD_IDF"
16982
echo "chunk_count=$chunks_count"
17083
echo "chunks=$chunks"
17184
} >> "$GITHUB_OUTPUT"

‎.github/workflows/allboards.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
with:
2020
ref: ${{ github.event.client_payload.branch }}
2121

@@ -32,13 +32,13 @@ jobs:
3232

3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v4
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636
with:
3737
ref: ${{ github.event.client_payload.branch }}
3838

3939
- run: npm install
4040
- name: Setup jq
41-
uses: dcarbone/install-jq-action@v1.0.1
41+
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
4242

4343
- id: set-test-chunks
4444
name: Set Chunks
@@ -64,7 +64,7 @@ jobs:
6464

6565
steps:
6666
- name: Checkout repository
67-
uses: actions/checkout@v4
67+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6868
with:
6969
ref: ${{ github.event.client_payload.branch }}
7070

@@ -74,7 +74,7 @@ jobs:
7474
FQBN: ${{ toJSON(matrix.chunk) }}
7575

7676
- name: Compile sketch
77-
uses: P-R-O-C-H-Y/compile-sketches@main
77+
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
7878
with:
7979
platforms: |
8080
${{ env.REPOSITORY }}

‎.github/workflows/boards.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
steps:
2323
# This step makes the contents of the repository available to the workflow
2424
- name: Checkout repository
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2626

2727
- name: Setup jq
28-
uses: dcarbone/install-jq-action@v1.0.1
28+
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
2929

3030
- name: Get board name
3131
run: bash .github/scripts/find_new_boards.sh ${{ github.repository }} ${{github.base_ref}}
@@ -47,7 +47,7 @@ jobs:
4747
steps:
4848
# This step makes the contents of the repository available to the workflow
4949
- name: Checkout repository
50-
uses: actions/checkout@v4
50+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5151

5252
- name: Check if build.board is uppercase
5353
run: |
@@ -60,7 +60,7 @@ jobs:
6060
fi
6161
6262
- name: Get libs cache
63-
uses: actions/cache@v4
63+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
6464
with:
6565
key: libs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package/package_esp32_index.template.json', 'tools/get.py') }}
6666
path: |
@@ -73,7 +73,7 @@ jobs:
7373
./tools/xtensa-*
7474
7575
- name: Compile sketch
76-
uses: P-R-O-C-H-Y/compile-sketches@main
76+
uses: P-R-O-C-H-Y/compile-sketches@a62f069b92dc8f5053da4ac439ea6d1950cf6379 # main
7777
with:
7878
platforms: |
7979
${{ env.REPOSITORY }}

‎.github/workflows/build_py_tools.yml

+21-12
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
all_changed_files: ${{ steps.verify-changed-files.outputs.all_changed_files }}
1919
steps:
2020
- name: Checkout repository
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2222
with:
2323
fetch-depth: 2
2424
ref: ${{ github.event.pull_request.head.ref }}
@@ -30,15 +30,16 @@ jobs:
3030
echo "Make sure you are using a branch inside the repository and not a fork."
3131
3232
- name: Verify Python Tools Changed
33+
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # v46.0.1
3334
id: verify-changed-files
34-
run: |
35-
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r ^HEAD -- tools/get.py tools/espota.py tools/gen_esp32part.py tools/gen_insights_package.py | xargs)
36-
echo "all_changed_files=$CHANGED_FILES" >> $GITHUB_OUTPUT
37-
if [ -n "$CHANGED_FILES" ]; then
38-
echo "any_changed=true" >> $GITHUB_OUTPUT
39-
else
40-
echo "any_changed=false" >> $GITHUB_OUTPUT
41-
fi
35+
with:
36+
fetch_depth: "2"
37+
since_last_remote_commit: "true"
38+
files: |
39+
tools/get.py
40+
tools/espota.py
41+
tools/gen_esp32part.py
42+
tools/gen_insights_package.py
4243
4344
- name: List all changed files
4445
shell: bash
@@ -88,25 +89,30 @@ jobs:
8889
for tool in ${{ env.CHANGED_TOOLS }}; do
8990
echo "tool $tool was changed"
9091
done
92+
9193
- name: Checkout repository
92-
uses: actions/checkout@v4
94+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9395
with:
9496
token: ${{ secrets.TOOLS_UPLOAD_PAT }}
9597
ref: ${{ github.event.pull_request.head.ref }}
98+
9699
- name: Set up Python 3.8
97-
uses: actions/setup-python@master
100+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
98101
with:
99102
python-version: 3.8
103+
100104
- name: Install dependencies
101105
run: |
102106
python -m pip install --upgrade pip
103107
pip install pyinstaller requests
108+
104109
- name: Build with PyInstaller
105110
shell: bash
106111
run: |
107112
for tool in ${{ env.CHANGED_TOOLS }}; do
108113
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=.github/pytools/espressif.ico tools/$tool.py
109114
done
115+
110116
- name: Sign binaries
111117
if: matrix.os == 'windows-latest'
112118
env:
@@ -119,12 +125,14 @@ jobs:
119125
{
120126
./.github/pytools/Sign-File.ps1 -Path ./${{ env.DISTPATH }}/$node.exe
121127
}
128+
122129
- name: Test binaries
123130
shell: bash
124131
run: |
125132
for tool in ${{ env.CHANGED_TOOLS }}; do
126133
./${{ env.DISTPATH }}/$tool${{ matrix.EXTEN }} -h
127134
done
135+
128136
- name: Push binary to tools
129137
if: matrix.os == 'windows-latest'
130138
env:
@@ -135,8 +143,9 @@ jobs:
135143
cp -f ./${{ env.DISTPATH }}/$tool.exe tools/$tool.exe
136144
done
137145
bash .github/scripts/upload_py_tools.sh "${{ env.CHANGED_TOOLS }}"
146+
138147
- name: Archive artifact
139-
uses: actions/upload-artifact@master
148+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
140149
with:
141150
name: ${{ env.DISTPATH }}
142151
path: ${{ env.DISTPATH }}

‎.github/workflows/dangerjs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Check out PR head
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616
with:
1717
ref: ${{ github.event.pull_request.head.sha }}
1818

1919
- name: DangerJS pull request linter
20-
uses: espressif/shared-github-dangerjs@v1
20+
uses: espressif/shared-github-dangerjs@fb17367fd3e8ff7412603b8e946d9b19ffdb2d7f # v1
2121
env:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
with:

‎.github/workflows/docs_build.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ jobs:
2121
run:
2222
shell: bash
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2525
with:
2626
submodules: true
27-
- uses: actions/setup-python@v5
27+
28+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
2829
with:
2930
cache-dependency-path: docs/requirements.txt
3031
cache: "pip"
3132
python-version: "3.10"
33+
3234
- name: Build
3335
run: |
3436
sudo apt update
@@ -38,8 +40,9 @@ jobs:
3840
cd ./docs
3941
PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary
4042
PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en
43+
4144
- name: Archive Docs
42-
uses: actions/upload-artifact@v4
45+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4346
with:
4447
name: docs
4548
path: docs

‎.github/workflows/docs_deploy.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ jobs:
2626
run: |
2727
echo "Release workflow failed. Exiting..."
2828
exit 1
29-
- uses: actions/checkout@v4
29+
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3031
with:
3132
submodules: true
32-
- uses: actions/setup-python@v5
33+
34+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.0.4
3335
with:
3436
cache-dependency-path: docs/requirements.txt
3537
cache: "pip"
3638
python-version: "3.10"
39+
3740
- name: Deploy Documentation
3841
env:
3942
# Deploy to production server

‎.github/workflows/gh-pages.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ jobs:
1515
name: Build GitHub Pages
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- name: Checkout repository
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
1921
- name: Copy Files
2022
env:
2123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)
Please sign in to comment.