Add Thread.onSpinWait() to infinite loops to possibly improve perform… #24
This file contains 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 characters
name: Update Flatpak Sources | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-flatpak-sources: | |
name: Get dependencies and update flatpak sources | |
runs-on: ubuntu-24.04 | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Set up JDK | |
- name: Set up JDK 23 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '23' | |
distribution: 'temurin' | |
# Step 3: Generate flatpak-sources.json | |
- name: Generate flatpak-sources.json | |
run: ./gradlew flatpakGradleGenerator | |
# Step 4: Compare flatpak-sources.json and create pull request if necessary | |
- name: Compare flatpak-sources.json and create pull request if necessary | |
run: | | |
git fetch origin main | |
BRANCH='update-flatpak-sources' | |
if ! diff -u <(jq . flatpak-sources.json) <(git show origin/main:flatpak-sources.json) >/dev/null; then | |
git config --global user.email "[email protected]" | |
git config --global user.name "ToxicStoxm" | |
# Fetch all branches from remote | |
git fetch origin | |
# Check if the branch exists remotely | |
if git ls-remote --heads origin $BRANCH | grep -q $BRANCH; then | |
echo "Branch $BRANCH exists on remote. Creating a local tracking branch." | |
# Temporarily stash changes | |
git stash --include-untracked | |
# Create a local branch that tracks the remote branch | |
git checkout -t origin/$BRANCH | |
# Restore stashed changes | |
git stash pop | |
else | |
echo "Branch $BRANCH does not exist. Creating a new branch." | |
git checkout -b $BRANCH | |
fi | |
# Check if there are any changes to commit | |
if git diff --quiet; then | |
echo "No changes to commit, skipping commit and PR creation." | |
else | |
# Stage and commit changes | |
git add flatpak-sources.json | |
git commit -m "Update flatpak-sources.json" | |
# Push the changes | |
git push --set-upstream origin $BRANCH | |
# Create a pull request | |
gh pr create -B main -H $BRANCH --title "Merge $BRANCH into main" --body "Created by Github action" | |
fi | |
else | |
echo "No changes detected in flatpak-sources.json. Skipping PR creation." | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |