From 8e5029a2671e578051101606f2e69379e178b92c Mon Sep 17 00:00:00 2001 From: neo <164915254+neoarz@users.noreply.github.com> Date: Tue, 15 Apr 2025 11:16:30 -0400 Subject: [PATCH] Update updatesource.yml --- .github/workflows/updatesource.yml | 84 +++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updatesource.yml b/.github/workflows/updatesource.yml index 4ad6ed6..123aaa3 100644 --- a/.github/workflows/updatesource.yml +++ b/.github/workflows/updatesource.yml @@ -19,4 +19,86 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} repository: 0-Blu/StikJIT ref: main - \ No newline at end of file + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests + + - name: Record job start time + id: job_start_time + run: echo "start_time=$(date +%s)" >> $GITHUB_OUTPUT + + - name: Debug repository information + run: | + echo "Repository: 0-Blu/StikJIT" + echo "Event name: $GITHUB_EVENT_NAME" + echo "Current directory: $(pwd)" + echo "Repository contents:" + ls -la + + - name: Update StikJIT source + id: update_source + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Configure git + git config --global user.name 'GitHub Action' + git config --global user.email 'action@github.com' + + # Run the update script + python update_json.py + + # Check for changes and commit if needed + git add repo.json + if git diff --staged --quiet; then + echo "changes=false" >> $GITHUB_OUTPUT + echo "No changes detected in repo.json" + else + echo "Changes detected in repo.json:" + git diff --staged + git commit -m "Updated source with latest StikJIT release" + # Push to main branch of original repository + git push origin main + echo "changes=true" >> $GITHUB_OUTPUT + fi + + - name: Calculate job duration + id: duration + if: always() + run: | + end_time=$(date +%s) + duration=$((end_time - ${{ steps.job_start_time.outputs.start_time }})) + echo "duration=$duration seconds" >> $GITHUB_OUTPUT + + - name: Create job summary + run: | + if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then + echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY + echo "✅ Changes Detected and Pushed" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "The repo.json file has been updated with the latest release information." >> $GITHUB_STEP_SUMMARY + else + echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY + echo "🔍 No Changes Detected" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "The repo.json file is up to date. No changes were necessary." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "This could be because:" >> $GITHUB_STEP_SUMMARY + echo "- The release version is already in the repo.json file" >> $GITHUB_STEP_SUMMARY + echo "- The release doesn't contain an IPA file" >> $GITHUB_STEP_SUMMARY + echo "- The release tag doesn't match the expected version format" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY + echo "🕐 Execution Time" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "This job took ${{ steps.duration.outputs.duration }} to complete." >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "📆 Next Scheduled Run" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "The next scheduled run will be triggered when a new release is published." >> $GITHUB_STEP_SUMMARY