-
-
Save SoftCreatR/e5d3771a56c840db63340d7981f16609 to your computer and use it in GitHub Desktop.
Revisions
-
SoftCreatR revised this gist
Jun 28, 2025 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/usr/bin/env bash set -euo pipefail # === Configuration === GITHUB_USER="USER" @@ -7,14 +8,13 @@ BRANCH="main" LAST_COMMIT_FILE=".last_commit" # GitHub API URL for the branch GIT_URL="https://github.com/${GITHUB_USER}/${REPO_NAME}.git" # Fetch the latest remote SHA LATEST_COMMIT_SHA=$(git ls-remote "$GIT_URL" "$BRANCH" | awk '{print $1}') if [[ -z "$LATEST_COMMIT_SHA" ]]; then echo "Error: couldn't retrieve SHA" exit 1 fi @@ -26,7 +26,7 @@ if [[ ! -f "$LAST_COMMIT_FILE" ]]; then fi # Load previously known SHA LAST_KNOWN_COMMIT=$(<"$LAST_COMMIT_FILE") # Compare if [[ "$LATEST_COMMIT_SHA" != "$LAST_KNOWN_COMMIT" ]]; then -
xopez revised this gist
Jun 27, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ #!/bin/bash # === Configuration === GITHUB_USER="USER" REPO_NAME="REPO" BRANCH="main" LAST_COMMIT_FILE=".last_commit" -
xopez renamed this gist
Jun 27, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xopez created this gist
Jun 27, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ #!/bin/bash # === Configuration === GITHUB_USER="xRuffKez" REPO_NAME="NRD" BRANCH="main" LAST_COMMIT_FILE=".last_commit" # GitHub API URL for the branch API_URL="https://api.github.com/repos/${GITHUB_USER}/${REPO_NAME}/commits/${BRANCH}" # NFetch latest commit SHA from the remote repository LATEST_COMMIT_SHA=$(curl -s "$API_URL" | grep '"sha":' | head -n 1 | cut -d '"' -f 4) # Abort if no SHA was received if [[ -z "$LATEST_COMMIT_SHA" ]]; then echo "Error: Could not retrieve the latest commit." exit 1 fi # If no SHA is stored yet, store it and notify if [[ ! -f "$LAST_COMMIT_FILE" ]]; then echo "$LATEST_COMMIT_SHA" > "$LAST_COMMIT_FILE" echo "First run – Commit SHA stored: $LATEST_COMMIT_SHA" exit 0 fi # Load previously known SHA LAST_KNOWN_COMMIT=$(cat "$LAST_COMMIT_FILE") # Compare if [[ "$LATEST_COMMIT_SHA" != "$LAST_KNOWN_COMMIT" ]]; then echo "New commit found: $LATEST_COMMIT_SHA" echo "$LATEST_COMMIT_SHA" > "$LAST_COMMIT_FILE" else echo "No new commit – everything is up to date." fi