From 318dce30fe2bde04661ff82dd4885b087fa8c69f Mon Sep 17 00:00:00 2001 From: JuanMa Garrido Date: Tue, 7 Jan 2025 19:32:24 +0100 Subject: [PATCH] remove update dates Github action --- .github/workflows/scripts/update_dates.sh | 53 ----------------------- .github/workflows/update-dates.yml | 38 ---------------- 2 files changed, 91 deletions(-) delete mode 100644 .github/workflows/scripts/update_dates.sh delete mode 100644 .github/workflows/update-dates.yml diff --git a/.github/workflows/scripts/update_dates.sh b/.github/workflows/scripts/update_dates.sh deleted file mode 100644 index c770c700..00000000 --- a/.github/workflows/scripts/update_dates.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -echo "Starting dates update process..." - -# Read examples.json -EXAMPLES_FILE="_data/examples.json" -TEMP_FILE="_data/examples.temp.json" - -# Create temp file if needed -if [ ! -f "$TEMP_FILE" ]; then - cp "$EXAMPLES_FILE" "$TEMP_FILE" -fi - -# Function to get Git dates for a folder -get_git_dates() { - local folder=$1 - - # Get first commit date (creation date) - local created=$(git log --reverse --format=%aI -- "$folder" | head -n 1) - - # Get last commit date (modification date) - local lastModified=$(git log -1 --format=%aI -- "$folder") - - # Return both dates in JSON format - echo "{\"created\":\"$created\",\"lastModified\":\"$lastModified\"}" -} - -# Read examples.json into a variable -EXAMPLES=$(cat "$EXAMPLES_FILE") - -# Process each example -UPDATED_EXAMPLES=$(echo "$EXAMPLES" | jq -c '.[]' | while read -r example; do - slug=$(echo "$example" | jq -r '.slug') - folder="plugins/$slug" - - if [ -d "$folder" ]; then - # Get dates from Git history - dates=$(get_git_dates "$folder") - created=$(echo "$dates" | jq -r '.created') - lastModified=$(echo "$dates" | jq -r '.lastModified') - - # Update the example with new dates - echo "$example" | jq --arg created "$created" --arg lastModified "$lastModified" \ - '. + {created: $created, lastModified: $lastModified}' - else - echo "$example" - fi -done | jq -s '.') - -# Write the updated content back to examples.json -echo "$UPDATED_EXAMPLES" > "$EXAMPLES_FILE" - -echo "Finished dates update process. ✅" \ No newline at end of file diff --git a/.github/workflows/update-dates.yml b/.github/workflows/update-dates.yml deleted file mode 100644 index 9d32cb13..00000000 --- a/.github/workflows/update-dates.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: _Update Creation and Modification Dates - -on: - workflow_dispatch: - schedule: - - cron: '0 0 1 * *' # Run monthly on the first day at midnight - -jobs: - update-dates: - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for all branches and tags - - - name: Make script executable - run: chmod +x .github/workflows/scripts/update_dates.sh - - - name: Update dates - env: - EXAMPLES_FILE: '_data/examples.json' - run: ./.github/workflows/scripts/update_dates.sh - - - name: Commit changes - run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add _data/examples.json - git diff --quiet && git diff --staged --quiet || git commit -m "Update creation and modification dates" - - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }}