name: KISS Auto Package Updater on: schedule: # Runs every Sunday at midnight (UTC) - cron: '0 0 * * 0' # Allows you to trigger this workflow manually from the Actions tab workflow_dispatch: permissions: contents: write pull-requests: write jobs: update-packages: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 with: # Fetch all history so we can branch cleanly fetch-depth: 0 - name: Set up Git Configuration run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - name: Set up KISS Linux Environment run: | sudo apt-get update sudo apt-get install -y b3sum curl -sL https://codeberg.org/kiss-community/kiss/raw/branch/master/contrib/kiss-outdated > /usr/local/bin/kiss-outdated curl -sL https://codeberg.org/kiss-community/kiss/raw/branch/master/kiss > /usr/local/bin/kiss curl -sL https://raw.githubusercontent.com/echawk/kiss-personal/refs/heads/master/bin/kiss-echecksum > /usr/local/bin/kiss-echecksum curl -sL https://raw.githubusercontent.com/echawk/kiss-personal/refs/heads/master/bin/kiss-edownload > /usr/local/bin/kiss-edownload chmod +x /usr/local/bin/kiss-outdated chmod +x /usr/local/bin/kiss-echecksum chmod +x /usr/local/bin/kiss-edownload chmod +x /usr/local/bin/kiss echo "Setting up KISS environment..." - name: Run KISS Auto Updater env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Ensure your KISS_PATH is set so `kiss outdated` knows where to look KISS_PATH: ${{ github.workspace }} run: | # Ensure the config file exists [ -e ".kiss_auto" ] || { echo "No .kiss_auto found. Exiting."; exit 1; } git checkout master sort -u ".kiss_auto" | while read -r LINE; do # Parse repository directory and packages whitelist repodir="${LINE%%,*}" pkgs="${LINE##*,}" # Convert space-separated packages into a regex list (pkg1|pkg2|pkg3) pkg_regex=$(echo "$pkgs" | sed 's/ /|/g') # Fetch outdated packages and filter by our whitelist # We use || true so grep doesn't exit the script if no matches are found outdated_list=$(kiss-outdated "$repodir" | grep -E "($pkg_regex)" || true) # If no updates, move to next repo line [ -z "$outdated_list" ] && continue echo "$outdated_list" | while read -r PKG_LINE; do # Parse kiss outdated output pkg="${PKG_LINE%% *}" newver="${PKG_LINE##* }" echo "==> Processing update for $pkg to version $newver" # Define branch name branch_name="update/${pkg}-${newver}" # Check if a PR already exists for this branch to avoid duplicates if gh pr list --state open --head "$branch_name" | grep -q "$branch_name"; then echo "PR for $branch_name already exists. Skipping." continue fi # Create and switch to a new branch for this specific package update git checkout -b "$branch_name" origin/master cd "${repodir}/${pkg}" read -r oldver oldrel < version # Bump version locally echo "$newver 1" > version # Attempt to download new sources if kiss edownload; then # Generate new checksums kiss echecksum # Stage, commit, and push git add . git commit -m "CI: $pkg: bump to $newver" git push origin "$branch_name" # Create the Pull Request using GitHub CLI gh pr create \ --title "$pkg: bump to $newver" \ --body "Automated update generated by CI. Bumping $pkg from $oldver to $newver." \ --base master \ --head "$branch_name" else echo "==> Failed to download sources for $pkg $newver. Skipping." fi # Return to workspace root and reset back to main for the next package loop cd "${GITHUB_WORKSPACE}" git reset --hard git checkout master done done