From cc4ee2c91061dcd12278bf2168b11cfb4be8e69a Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Mon, 5 Feb 2024 14:07:33 +0100 Subject: [PATCH] [CI] Update actions to the latest versions Signed-off-by: Vitalii Koshura --- .../all_projects_list_xml_update.yml | 4 +- .github/workflows/android.yml | 40 ++++---- .github/workflows/coverity.yml | 6 +- .github/workflows/flutter-macos.yml | 8 +- .github/workflows/flutter-ubuntu.yml | 18 ++-- .github/workflows/flutter-windows.yml | 10 +- .github/workflows/linux-package.yml | 58 ++++++------ .github/workflows/linux.yml | 25 +++-- .github/workflows/mingw.yml | 6 +- .github/workflows/osx.yml | 28 +++--- .github/workflows/snap.yml | 8 +- .github/workflows/source-code-check.yml | 2 +- .github/workflows/test-report.yml | 12 ++- .github/workflows/update_actions.yml | 56 +++++++++++ .github/workflows/update_copyright_year.yml | 4 +- .github/workflows/wasm.yml | 8 +- .github/workflows/windows.yml | 24 ++--- ci_tools/update_actions.py | 92 +++++++++++++++++++ 18 files changed, 280 insertions(+), 129 deletions(-) create mode 100644 .github/workflows/update_actions.yml create mode 100644 ci_tools/update_actions.py diff --git a/.github/workflows/all_projects_list_xml_update.yml b/.github/workflows/all_projects_list_xml_update.yml index 1efe3a030d..6451ddaf4e 100644 --- a/.github/workflows/all_projects_list_xml_update.yml +++ b/.github/workflows/all_projects_list_xml_update.yml @@ -30,7 +30,7 @@ jobs: type: [all_projects_list_xml_update] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Download latest all_projects_list.xml @@ -45,7 +45,7 @@ jobs: echo "PR_REQUIRED=$?" >> $GITHUB_ENV - name: Create PR if: ${{ success() && env.PR_REQUIRED == 1 }} - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e with: commit-message: Update all_projects_list.xml title: Update all_projects_list.xml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index c0482958ce..e574b7e9d9 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -43,7 +43,7 @@ jobs: type: [armv6, arm, arm64, x86, x86_64] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -78,14 +78,14 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: android_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z - name: Upload client on success if: ${{ success() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: android_client_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ @@ -99,48 +99,48 @@ jobs: task: [assembleRelease, assembleXiaomi_release, assembleArmv6_release, jacocoTestReportDebug] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Download armv6 client - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: android_client_armv6_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ - name: Download arm client - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: android_client_arm_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ - name: Download arm64 client - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: android_client_arm64_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ - name: Download x86 client - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: android_client_x86_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ - name: Download x86_64 client - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: android_client_x86_64_${{ github.event.pull_request.head.sha }} path: android/BOINC/app/src/main/assets/ - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 with: distribution: 'zulu' java-version: "17" - name: Setup Android SDK - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 - name: Build manager with vcpkg run: ./android/ci_build_vcpkg_manager.sh --skip-client-build --tasks "clean ${{ matrix.task }}" @@ -151,7 +151,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: android_logs_manager_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -160,35 +160,35 @@ jobs: run: python ./deploy/prepare_deployment.py android_manager - name: Upload generic artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ matrix.task == 'assembleRelease' }} with: name: android_manager_${{ github.event.pull_request.head.sha }} path: deploy/android_manager.7z - name: Upload xiaomi manager - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ matrix.task == 'assembleXiaomi_release' }} with: name: android_xiaomi_manager_${{ github.event.pull_request.head.sha }} path: deploy/android_manager_xiaomi.7z - name: Upload armv6 only manager - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ matrix.task == 'assembleArmv6_release' }} with: name: android_armv6_manager_${{ github.event.pull_request.head.sha }} path: deploy/android_manager_armv6.7z - name: Upload JUnit Tests Results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ always() && matrix.task == 'jacocoTestReportDebug' }} with: name: Android_tests_results path: android/BOINC/app/build/test-results/testDebugUnitTest/TEST-*.xml - name: Upload coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed if: ${{ matrix.task == 'jacocoTestReportDebug' }} with: fail_ci_if_error: true @@ -202,7 +202,7 @@ jobs: type: [libs, apps, libs-cmake] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -245,7 +245,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: android_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -255,7 +255,7 @@ jobs: run: python ./deploy/prepare_deployment.py android_${{ matrix.type }} - name: Upload generic artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ ! contains(matrix.type, 'libs') }} with: name: android_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index 66c60fe8c8..a9995e1718 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -36,7 +36,7 @@ jobs: sudo apt-get install -y libftgl-dev freeglut3-dev libcurl4-openssl-dev libxmu-dev libxi-dev libfcgi-dev libxss-dev libnotify-dev libxcb-util0-dev libgtk-3-dev libsecret-1-dev libgcrypt20-dev libsystemd-dev libwebkit2gtk-4.0-dev p7zip-full libxxf86vm-dev ocl-icd-opencl-dev zip - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: | 3rdParty/buildCache @@ -52,7 +52,7 @@ jobs: run: ./3rdParty/buildLinuxDependencies.sh && ./configure --enable-apps --with-wx-prefix=${GITHUB_WORKSPACE}/3rdParty/buildCache/linux - name: Coverity Scan - uses: vapier/coverity-scan-action@v1 + uses: vapier/coverity-scan-action@2068473c7bdf8c2fb984a6a40ae76ee7facd7a85 with: project: 'BOINC/boinc' token: ${{ secrets.COVERITY_SCAN_TOKEN }} diff --git a/.github/workflows/flutter-macos.yml b/.github/workflows/flutter-macos.yml index 0f329bfe3b..02aacaa177 100644 --- a/.github/workflows/flutter-macos.yml +++ b/.github/workflows/flutter-macos.yml @@ -37,17 +37,17 @@ jobs: type: [macos, ios] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Setup xcode - uses: maxim-lobanov/setup-xcode@v1 + uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: '12.5.1' - name: Setup flutter - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'beta' @@ -56,7 +56,7 @@ jobs: run: flutter config --enable-macos-desktop - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 if: matrix.type == 'macos' with: path: 3rdParty/buildCache diff --git a/.github/workflows/flutter-ubuntu.yml b/.github/workflows/flutter-ubuntu.yml index d258918a67..2a51dba724 100644 --- a/.github/workflows/flutter-ubuntu.yml +++ b/.github/workflows/flutter-ubuntu.yml @@ -42,23 +42,23 @@ jobs: type: [linux, android] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 1 - name: Setup Java if: matrix.type == 'android' - uses: actions/setup-java@v3 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 with: distribution: 'zulu' java-version: '17' - name: Setup android SDK if: matrix.type == 'android' - uses: android-actions/setup-android@v2 + uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 - name: Setup flutter - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'beta' @@ -73,7 +73,7 @@ jobs: sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 if: matrix.type == 'linux' with: path: | @@ -96,7 +96,7 @@ jobs: run: samples/flutter/ci_build_linux.sh - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 if: matrix.type == 'android' with: path: | @@ -129,19 +129,19 @@ jobs: - name: Prepare android if: success() && matrix.type == 'android' - uses: edgarrc/action-7z@v1 + uses: edgarrc/action-7z@93485892b5468e89cfb2c28a8d1c0e3904906458 with: args: 7z a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/app/outputs/flutter-apk/app-release.apk - name: Prepare linux if: success() && matrix.type == 'linux' - uses: edgarrc/action-7z@v1 + uses: edgarrc/action-7z@93485892b5468e89cfb2c28a8d1c0e3904906458 with: args: 7z a -t7z -mx=9 deploy/flutter_${{ matrix.type }}.7z -r0 samples/flutter/boinc/build/linux/x64/release/bundle/* - name: Upload ${{ matrix.type }} if: success() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: ${{ matrix.type }}_flutter_${{ github.event.pull_request.head.sha }} path: deploy/flutter_${{ matrix.type }}.7z diff --git a/.github/workflows/flutter-windows.yml b/.github/workflows/flutter-windows.yml index 114939afce..bdf878ea26 100644 --- a/.github/workflows/flutter-windows.yml +++ b/.github/workflows/flutter-windows.yml @@ -42,15 +42,15 @@ jobs: type: [windows, web, winuwp] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Setup msbuild - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce - name: Setup flutter - uses: subosito/flutter-action@v1 + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: channel: 'dev' @@ -63,7 +63,7 @@ jobs: run: flutter config --enable-windows-desktop - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 if: matrix.type == 'windows' with: path: | @@ -128,7 +128,7 @@ jobs: - name: Upload ${{ matrix.type }} if: success() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: ${{ matrix.type }}_flutter_${{ github.event.pull_request.head.sha }} path: deploy/flutter_${{ matrix.type }}.7z diff --git a/.github/workflows/linux-package.yml b/.github/workflows/linux-package.yml index 0e10b9ca40..ca8c99431a 100644 --- a/.github/workflows/linux-package.yml +++ b/.github/workflows/linux-package.yml @@ -56,7 +56,7 @@ jobs: type: [client, manager] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Check if build is running from origin repo @@ -108,7 +108,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: linux-package_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -118,7 +118,7 @@ jobs: run: python3 ./deploy/prepare_deployment.py linux_${{ matrix.type }} - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: success() with: name: linux-package_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} @@ -136,7 +136,7 @@ jobs: env: ARCH: amd64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 if: success() with: fetch-depth: 2 @@ -167,7 +167,7 @@ jobs: - name: Download if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: pkgs/ @@ -225,7 +225,7 @@ jobs: dpkg-deb --info "${{ github.workspace }}/${PKG_FULL}.deb" - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: success() with: name: linux-package_${{ matrix.type }}_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -246,7 +246,7 @@ jobs: ARCH: x86_64 PUBKEY_HASH: D4460B4F0EEDE2C0662092F640254C9B29853EA6 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 if: success() with: fetch-depth: 2 @@ -285,7 +285,7 @@ jobs: - name: Download if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: pkgs/ @@ -571,7 +571,7 @@ jobs: rpm -qp --qf '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{(none)}|}|\n' "RPMS/${{ env.ARCH }}/${PKG_FULL}.rpm" - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: success() with: name: linux-package_${{ matrix.type }}_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -588,7 +588,7 @@ jobs: os: [buster, bullseye, bookworm] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -600,13 +600,13 @@ jobs: - name: Download client if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -633,7 +633,7 @@ jobs: os: [focal, jammy] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -645,13 +645,13 @@ jobs: - name: Download client if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -678,7 +678,7 @@ jobs: os: [37, 38, 39] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -689,13 +689,13 @@ jobs: - name: Download client if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_fc${{ matrix.os }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_fc${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -726,7 +726,7 @@ jobs: run: | zypper install -y python3 tar gzip - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -737,13 +737,13 @@ jobs: - name: Download client if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_suse${{ env.OS }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: success() - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_suse${{ env.OS }}_${{ github.event.pull_request.head.sha }} @@ -778,7 +778,7 @@ jobs: run: | echo "SKIP_RUN=1" >> $GITHUB_ENV - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 if: ${{ success() && env.SKIP_RUN == 0 }} with: fetch-depth: 2 @@ -802,13 +802,13 @@ jobs: - name: Download client if: ${{ success() && env.SKIP_RUN == 0 }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: ${{ success() && env.SKIP_RUN == 0 }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -837,7 +837,7 @@ jobs: cd ${{ github.workspace }}/.github/workflows/debrepo/ ./repo_update.sh "$ALLOW_CREATE" ${{ env.BASEREPO }} ${{ github.workspace }} ${{ matrix.os }} ${{ env.RELEASE_TYPE }} ${{ env.PUBKEY }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ success() && env.SKIP_RUN == 0 }} with: name: repo-${{ env.RELEASE_TYPE }}-${{ matrix.os }} @@ -874,7 +874,7 @@ jobs: run: | echo "SKIP_RUN=1" >> $GITHUB_ENV - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 if: ${{ success() && env.SKIP_RUN == 0 }} with: fetch-depth: 2 @@ -901,13 +901,13 @@ jobs: - name: Download client if: ${{ success() && env.SKIP_RUN == 0 }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_client_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} - name: Download manager if: ${{ success() && env.SKIP_RUN == 0 }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: name: linux-package_manager_${{ matrix.os }}_${{ github.event.pull_request.head.sha }} @@ -940,7 +940,7 @@ jobs: # Updates or creates the repository ./repo_update.sh "$ALLOW_CREATE" ${{ env.BASEREPO }} ${CWD} ${{ matrix.os }} ${{ env.RELEASE_TYPE }} ${{ env.PUBKEY }} ${{ env.PUBKEY_HASH }} ${{ env.ARCH }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ success() && env.SKIP_RUN == 0 }} with: name: repo-${{ env.RELEASE_TYPE }}-${{ matrix.os }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c0a4c9fe60..014f750d39 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -43,7 +43,7 @@ jobs: type: [libs, client, apps, libs-vcpkg, client-vcpkg, apps-vcpkg, libs-cmake, libs-arm64, apps-arm64, manager-with-webview-vcpkg, server, manager-with-webview, manager-without-webview, unit-test, integration-test] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -65,7 +65,7 @@ jobs: ./integration_test/installTestSuite.sh - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: | 3rdParty/buildCache @@ -171,7 +171,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: linux_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -181,25 +181,24 @@ jobs: run: python ./deploy/prepare_deployment.py linux_${{ matrix.type }} - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ ! contains(matrix.type, 'libs') && ! contains(matrix.type, 'server') && ! contains(matrix.type, 'test') }} with: name: linux_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/linux_${{ matrix.type }}.7z - name: Upload Google Tests Results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: always() && matrix.type == 'unit-test' # run this step even if previous step failed with: name: Linux_tests_results path: "tests/gtest/**/*_xml_report.xml" - name: Upload coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed if: success() && matrix.type == 'unit-test' with: fail_ci_if_error: true - gcov: true verbose: false build-release: @@ -223,7 +222,7 @@ jobs: run: | apt-get install -y libcurl4-openssl-dev - - uses: actions/checkout@v1 + - uses: actions/checkout@v1 # ignore-check with: fetch-depth: 2 @@ -268,7 +267,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v1 # ignore-check with: name: linux_release_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -278,7 +277,7 @@ jobs: run: python3 ./deploy/prepare_deployment.py linux_apps - name: Upload wrapper artifacts - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v1 # ignore-check if: success() with: name: linux_release_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} @@ -304,7 +303,7 @@ jobs: run: | apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu wget ca-certificates p7zip-full python3 - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 # ignore-check with: fetch-depth: 2 @@ -329,7 +328,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3 # ignore-check with: name: linux_release_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -339,7 +338,7 @@ jobs: run: python3 ./deploy/prepare_deployment.py linux_apps - name: Upload wrapper artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3 # ignore-check if: success() with: name: linux_release_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index e7f78f950f..0b79b60613 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -43,7 +43,7 @@ jobs: type: [libs-mingw, apps-mingw, apps-mingw-vcpkg, libs-mingw-cmake] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Check if build is running from origin repo if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }} @@ -114,7 +114,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: mingw_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -124,7 +124,7 @@ jobs: run: python ./deploy/prepare_deployment.py win_${{ matrix.type }} - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{! contains(matrix.type, 'libs')}} with: name: win_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml index 2660e0478d..e3373213e3 100644 --- a/.github/workflows/osx.yml +++ b/.github/workflows/osx.yml @@ -39,14 +39,14 @@ jobs: name: build-dependencies runs-on: macos-latest steps: - - uses: maxim-lobanov/setup-xcode@v1 + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: '14.2.0' - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: 3rdParty/buildCache key: osx-${{ hashFiles('.github/workflows/osx.yml', '3rdParty/buildMacDependencies.sh', 'mac_build/dependencyNames.sh', 'mac_build/buildc-ares.sh', 'mac_build/buildcurl.sh', 'mac_build/buildfreetype.sh', 'mac_build/buildFTGL.sh', 'mac_build/buildopenssl.sh', 'mac_build/buildWxMac.sh') }} @@ -63,14 +63,14 @@ jobs: type: [manager, samples-makefile] fail-fast: false steps: - - uses: maxim-lobanov/setup-xcode@v1 + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: '14.2.0' - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: 3rdParty/buildCache key: osx-${{ hashFiles('.github/workflows/osx.yml', '3rdParty/buildMacDependencies.sh', 'mac_build/dependencyNames.sh', 'mac_build/buildc-ares.sh', 'mac_build/buildcurl.sh', 'mac_build/buildfreetype.sh', 'mac_build/buildFTGL.sh', 'mac_build/buildopenssl.sh', 'mac_build/buildWxMac.sh') }} @@ -89,7 +89,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -99,27 +99,27 @@ jobs: - name: Upload manager if: matrix.type == 'manager' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_manager_${{ github.event.pull_request.head.sha }} path: deploy/macos_manager.7z - name: Upload apps - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_${{ matrix.type }}_apps_${{ github.event.pull_request.head.sha }} path: deploy/macos_apps.7z - name: Upload x86_64 apps if: matrix.type == 'samples-makefile' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_x86_64_apps_${{ github.event.pull_request.head.sha }} path: deploy/macos_apps_x86_64.7z - name: Upload arm64 apps if: matrix.type == 'samples-makefile' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_arm64_apps_${{ github.event.pull_request.head.sha }} path: deploy/macos_apps_arm64.7z @@ -128,11 +128,11 @@ jobs: name: cmake-build runs-on: macos-latest steps: - - uses: maxim-lobanov/setup-xcode@v1 + - uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd with: xcode-version: '14.2.0' - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Check if build is running from origin repo if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }} @@ -153,7 +153,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: osx_logs_cmake-build_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index d6699f1d1f..8127e6ad02 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -47,7 +47,7 @@ jobs: snap_file: boinc_amd64.snap steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Install dependencies run: | @@ -66,7 +66,7 @@ jobs: - name: Configure docker qemu if: success() - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 - name: Build boinc snap if: success() @@ -115,7 +115,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: snap_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -125,7 +125,7 @@ jobs: run: python ./deploy/prepare_deployment.py linux_snap - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: success() with: name: linux_snap_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/source-code-check.yml b/.github/workflows/source-code-check.yml index 2daebe4b3c..d655290913 100644 --- a/.github/workflows/source-code-check.yml +++ b/.github/workflows/source-code-check.yml @@ -38,7 +38,7 @@ jobs: type: [source-code-check] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Check source code for illegal symbols diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml index 776706c033..c9d4fb9bb4 100644 --- a/.github/workflows/test-report.yml +++ b/.github/workflows/test-report.yml @@ -26,10 +26,14 @@ jobs: report: runs-on: ubuntu-latest steps: - - uses: dorny/test-reporter@v1 + - name: Download artifacts + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 with: - artifact: /(.*)_tests_results/ # artifact name - name: $1 Tests Report # Name of the check run which will be created - path: '*.xml' # Path to test results (inside artifact .zip) + run-id: ${{ github.event.workflow_run.id }} + path: test-reports + - uses: dorny/test-reporter@c40d89d5e987cd80f3a32b3c233556e22bdca958 + with: + name: 'Tests Report' + path: 'test-reports/**/*.xml' reporter: java-junit fail-on-error: false diff --git a/.github/workflows/update_actions.yml b/.github/workflows/update_actions.yml new file mode 100644 index 0000000000..38df70c394 --- /dev/null +++ b/.github/workflows/update_actions.yml @@ -0,0 +1,56 @@ +# This file is part of BOINC. +# http://boinc.berkeley.edu +# Copyright (C) 2024 University of California +# +# BOINC is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any later version. +# +# BOINC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with BOINC. If not, see . + +name: Update Actions +on: + schedule: + - cron: '0 0 * * 0' + +jobs: + build: + if: github.repository == 'BOINC/boinc' + name: ${{ matrix.type }} + runs-on: ubuntu-latest + strategy: + matrix: + type: [update_actions] + fail-fast: false + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + fetch-depth: 2 + - name: Update actions + if: success() + run: | + python ./ci_tools/update_actions.py ${ACTIONS_UPDATE_TOKEN} + - name: Check file was updated + if: success() + run: | + set +e + git diff --exit-code + echo "PR_REQUIRED=$?" >> $GITHUB_ENV + - name: Create PR + if: ${{ success() && env.PR_REQUIRED == 1 }} + uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e + with: + commit-message: Update actions + title: Update actions + body: | + This PR was automatically created by a GitHub Action. + branch: update_actions + base: master + delete-branch: true diff --git a/.github/workflows/update_copyright_year.yml b/.github/workflows/update_copyright_year.yml index c6360d541b..d45102630f 100644 --- a/.github/workflows/update_copyright_year.yml +++ b/.github/workflows/update_copyright_year.yml @@ -30,7 +30,7 @@ jobs: type: [update_copyright_year] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Update copyright year @@ -45,7 +45,7 @@ jobs: echo "PR_REQUIRED=$?" >> $GITHUB_ENV - name: Create PR if: ${{ success() && env.PR_REQUIRED == 1 }} - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e with: commit-message: Update copyright year title: Update copyright year diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index a31ba24de3..464c011cb7 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -43,7 +43,7 @@ jobs: type: [client, client-debug] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 @@ -53,7 +53,7 @@ jobs: sudo apt-get install -y p7zip-full zip - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: | 3rdParty/buildCache @@ -93,7 +93,7 @@ jobs: - name: Upload logs on failure if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: wasm_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} path: deploy/logs.7z @@ -113,7 +113,7 @@ jobs: run: python ./deploy/prepare_deployment.py wasm_${{ matrix.type }} - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 if: ${{ ! contains(matrix.type, 'libs') }} with: name: wasm_${{ matrix.type }}_${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ba1c712ced..c231b59123 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -46,12 +46,12 @@ jobs: fail-fast: false steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: fetch-depth: 2 - name: Download OpenCppCoverage - uses: suisei-cn/actions-download-file@v1 + uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 if: success() && matrix.platform == 'x64' id: DownloadOpenCppCoverage with: @@ -60,13 +60,13 @@ jobs: - name: Unzip OpenCppCoverage if: success() && matrix.platform == 'x64' - uses: DuckSoft/extract-7z-action@v1.0 + uses: DuckSoft/extract-7z-action@6eaaa506b410f047eaa9b22498696aad1e19a834 with: pathSource: ${{github.workspace}}\temp\OpenCppCoverage-0.9.7.1.vsix pathTarget: ${{github.workspace}}\temp\OpenCppCoverage - name: Setup msbuild - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce - name: Check if build is running from origin repo if: ${{success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0}} @@ -82,7 +82,7 @@ jobs: run: vcpkg.exe integrate remove - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: | ${{github.workspace}}\3rdParty\Windows\cuda\ @@ -108,7 +108,7 @@ jobs: - name: Upload logs on failure if: ${{failure()}} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: windows_logs_${{matrix.type}}_${{github.event.pull_request.head.sha}} path: deploy/logs.7z @@ -123,42 +123,42 @@ jobs: - name: Upload apps if: success() && matrix.type == 'msbuild' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: win_apps_${{matrix.platform}}_${{github.event.pull_request.head.sha}} path: deploy/win_apps.7z - name: Upload client if: success() && matrix.type == 'msbuild' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: win_client_${{matrix.platform}}_${{github.event.pull_request.head.sha}} path: deploy/win_client.7z - name: Upload manager if: success() && matrix.type == 'msbuild' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: win_manager_${{matrix.platform}}_${{github.event.pull_request.head.sha}} path: deploy/win_manager.7z - name: Upload symbol files if: success() && matrix.type == 'msbuild' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: win_pdb_${{matrix.platform}}_${{github.event.pull_request.head.sha}} path: win_build/Build/${{matrix.platform}}/${{matrix.configuration}}/*.pdb - name: Upload Google Tests Results if: always() && matrix.platform == 'x64' && matrix.type == 'msbuild' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 with: name: Windows_tests_results path: "win_build/Build/${{matrix.platform}}/${{matrix.configuration}}/**/gtest.xml" - name: Upload coverage report if: success() && matrix.platform == 'x64' && matrix.type == 'msbuild' - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed with: fail_ci_if_error: true verbose: false diff --git a/ci_tools/update_actions.py b/ci_tools/update_actions.py new file mode 100644 index 0000000000..28900d2a44 --- /dev/null +++ b/ci_tools/update_actions.py @@ -0,0 +1,92 @@ +import os +import requests +import sys + +def get_all_yml_files(): + yml_files = [] + for root, _, files in os.walk(".github/workflows", topdown=True): + for filename in files: + if filename.endswith(".yml"): + yml_files.append(os.path.join(root, filename)) + return yml_files + +def get_all_actions(yml_files): + actions = [] + for yml_file in yml_files: + with open(yml_file, "r") as f: + lines = f.readlines() + for line in lines: + if "uses: " in line: + line = line.strip() + line = line.split("@")[0] + line = line.split("uses: ")[1] + res = line.split(" ") + if len(res) > 1 and res[1] == "# ignore-check": + continue + line = res[0] + if line not in actions: + actions.append(line) + return actions + +def get_action_with_sha(action, token): + if token is not None: + headers = {'Authorization': f'Bearer {token}'} + else: + headers = None + res = requests.get(f'https://api.github.com/repos/{action}/releases/latest', headers=headers).json() + tag_name = res['tag_name'] + res = requests.get(f'https://api.github.com/repos/{action}/git/ref/tags/{tag_name}', headers=headers).json() + object_type = res['object']['type'] + tag_sha = res['object']['sha'] + if object_type != 'commit': + res = requests.get(f'https://api.github.com/repos/{action}/git/tags/{tag_sha}', headers=headers).json() + tag_sha = res['object']['sha'] + return action, tag_sha + +def get_all_actions_with_sha(actions, token): + actions_with_sha = [] + for action in actions: + actions_with_sha.append(get_action_with_sha(action, token)) + return actions_with_sha + +def get_action_sha(actions_with_sha, action): + for action_with_sha in actions_with_sha: + if action_with_sha[0] == action: + return action_with_sha[1] + +def process_yml_file(yml_file, actions_with_sha): + print("Processing file: " + yml_file) + with open(yml_file, "r") as f: + lines = f.readlines() + with open(yml_file, "w") as f: + for line in lines: + new_line = line + if "uses: " in new_line: + new_line = new_line.strip() + res = new_line.split("@") + version = res[1] + new_line = res[0] + new_line = new_line.split("uses: ")[1] + res = version.split(" ") + if len(res) == 1: + version = res[0] + new_sha = get_action_sha(actions_with_sha, new_line) + if new_sha != version: + line = line.replace(version, new_sha) + f.write(line) + +def process_all_yml_files(yml_files, actions_with_sha): + for yml_file in yml_files: + process_yml_file(yml_file, actions_with_sha) + + +if (len(sys.argv) > 1): + token = sys.argv[1] +else: + token = None + +yml_files = get_all_yml_files() + +latest_actions = get_all_actions_with_sha(get_all_actions(yml_files), token) + +process_all_yml_files(yml_files, latest_actions)