Skip to content

check-magnet-response-hash #634

check-magnet-response-hash

check-magnet-response-hash #634

# This workflow should download the latest magnet-response exe, and compare the previous hash
# with the current hash.
name: check-magnet-response-hash
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
magnet_response_hash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Check Magnet Response Hash
run: |
MAGNET_VERSION=$(cat /home/runner/work/winfor-salt/winfor-salt/winfor/standalones/magnet-response.sls | grep "set version" | awk -F\' '{print tolower($2)}')
wget https://storage.googleapis.com/mfi-files/free_tools/MagnetRESPONSE/MagnetRESPONSEv${MAGNET_VERSION}_Self_Extracting_Archive.exe
PREVIOUS_HASH=$(cat /home/runner/work/winfor-salt/winfor-salt/winfor/standalones/magnet-response.sls | grep "set hash" | awk -F\' '{print tolower($2)}')
CURRENT_HASH=$(sha256sum MagnetRESPONSEv${MAGNET_VERSION}_Self_Extracting_Archive.exe | awk '{print $1}')
if [[ "$PREVIOUS_HASH" != "$CURRENT_HASH" ]]; then echo "HASH UPDATED - $CURRENT_HASH" && exit 1; else echo "No hash changes" && exit 0; fi