This commit is contained in:
neoarz 2025-04-14 21:32:02 -04:00
parent df88e8b625
commit 6d7b2d38a5
2 changed files with 14 additions and 46 deletions

View file

@ -8,7 +8,6 @@ on:
# Add permissions block to ensure the workflow can push changes
permissions:
contents: write
pull-requests: write
jobs:
update-source:
@ -16,9 +15,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: main # Explicitly checkout the main branch
fetch-depth: 0 # Fetch all history for proper branching
- name: Set up Python
uses: actions/setup-python@v4
@ -38,11 +34,6 @@ jobs:
run: |
echo "Repository: $GITHUB_REPOSITORY"
echo "Event name: $GITHUB_EVENT_NAME"
echo "Event path: $GITHUB_EVENT_PATH"
if [ -f "$GITHUB_EVENT_PATH" ]; then
echo "Event payload:"
cat $GITHUB_EVENT_PATH
fi
echo "Current directory: $(pwd)"
echo "Repository contents:"
ls -la
@ -52,9 +43,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python update_json.py
# 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
@ -62,33 +58,12 @@ jobs:
else
echo "Changes detected in repo.json:"
git diff --staged
# Create a new branch for the changes
BRANCH_NAME="update-source-$(date +%Y%m%d-%H%M%S)"
git checkout -b $BRANCH_NAME
git commit -m "Updated source with latest StikJIT release"
git push origin $BRANCH_NAME
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
# Force push to main
git push -f origin HEAD:main
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.update_source.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.update_source.outputs.branch }}
base: main
title: "Update StikJIT source with latest release"
body: |
This PR updates the repo.json file with the latest StikJIT release information.
Changes include:
- Updated version information
- Added new release to versions list
- Updated news section
Please review and merge if everything looks good.
- name: Calculate job duration
id: duration
if: always()
@ -101,9 +76,9 @@ jobs:
run: |
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then
echo "## Update StikJIT Source Summary 🚀" >> $GITHUB_STEP_SUMMARY
echo "✅ Changes Detected and Pull Request Created" >> $GITHUB_STEP_SUMMARY
echo "✅ Changes Detected and Pushed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "A pull request has been created to update the repo.json file with the latest release information." >> $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