wf test
This commit is contained in:
@@ -22,6 +22,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
run: |
|
run: |
|
||||||
|
# Clean up any previous runs to avoid "destination path already exists" errors
|
||||||
|
if [ -d "/tmp/nixpkgs" ]; then
|
||||||
|
echo "Cleaning up existing /tmp/nixpkgs directory..."
|
||||||
|
rm -rf /tmp/nixpkgs
|
||||||
|
fi
|
||||||
|
|
||||||
# Disable terminal prompts for all git operations
|
# Disable terminal prompts for all git operations
|
||||||
export GIT_TERMINAL_PROMPT=0
|
export GIT_TERMINAL_PROMPT=0
|
||||||
export GIT_ASKPASS="/bin/echo"
|
export GIT_ASKPASS="/bin/echo"
|
||||||
@@ -33,10 +39,11 @@ jobs:
|
|||||||
|
|
||||||
cd /tmp/nixpkgs
|
cd /tmp/nixpkgs
|
||||||
|
|
||||||
# Configure git author/committer
|
# Configure git author/committer (local to this repo)
|
||||||
git config --global user.name "${{ env.GIT_AUTHOR_NAME }}"
|
# Removing --global to avoid polluting the runner's user config
|
||||||
git config --global user.email "${{ env.GIT_AUTHOR_EMAIL }}"
|
git config user.name "${{ env.GIT_AUTHOR_NAME }}"
|
||||||
git config --global init.defaultBranch master
|
git config user.email "${{ env.GIT_AUTHOR_EMAIL }}"
|
||||||
|
git config init.defaultBranch master
|
||||||
|
|
||||||
# Verify checkout
|
# Verify checkout
|
||||||
git status
|
git status
|
||||||
@@ -45,8 +52,13 @@ jobs:
|
|||||||
- name: Check for available packages to update
|
- name: Check for available packages to update
|
||||||
id: check-packages
|
id: check-packages
|
||||||
run: |
|
run: |
|
||||||
|
cd /tmp/nixpkgs
|
||||||
echo "Found packages in pkgs/ directory:"
|
echo "Found packages in pkgs/ directory:"
|
||||||
ls -1 pkgs/ | grep -v default.nix | grep -v AGENTS.md || echo "No package directories found"
|
if [ -d "pkgs" ]; then
|
||||||
|
find pkgs -mindepth 1 -maxdepth 1 -type d -not -name default.nix | grep -v AGENTS.md || echo "No packages found"
|
||||||
|
else
|
||||||
|
echo "pkgs directory not found"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if flake.nix exists
|
# Check if flake.nix exists
|
||||||
if [ -f "flake.nix" ]; then
|
if [ -f "flake.nix" ]; then
|
||||||
@@ -60,6 +72,7 @@ jobs:
|
|||||||
- name: Update packages
|
- name: Update packages
|
||||||
id: update
|
id: update
|
||||||
run: |
|
run: |
|
||||||
|
cd /tmp/nixpkgs
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create timestamp for branch naming
|
# Create timestamp for branch naming
|
||||||
@@ -92,7 +105,11 @@ jobs:
|
|||||||
echo "Checking all packages for updates..."
|
echo "Checking all packages for updates..."
|
||||||
|
|
||||||
# Get list of package directories (exclude default.nix and AGENTS.md)
|
# Get list of package directories (exclude default.nix and AGENTS.md)
|
||||||
PACKAGES=$(find pkgs -mindepth 1 -maxdepth 1 -type d -not -name default.nix -not -name AGENTS.md -exec basename {} \; 2>/dev/null | sort)
|
if [ -d "pkgs" ]; then
|
||||||
|
PACKAGES=$(find pkgs -mindepth 1 -maxdepth 1 -type d -not -name default.nix -not -name AGENTS.md -exec basename {} \; 2>/dev/null | sort)
|
||||||
|
else
|
||||||
|
PACKAGES=""
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$PACKAGES" ]; then
|
if [ -z "$PACKAGES" ]; then
|
||||||
echo "No packages found to update"
|
echo "No packages found to update"
|
||||||
@@ -153,6 +170,7 @@ jobs:
|
|||||||
- name: Verify packages build
|
- name: Verify packages build
|
||||||
if: steps.update.outputs.has_updates == 'true'
|
if: steps.update.outputs.has_updates == 'true'
|
||||||
run: |
|
run: |
|
||||||
|
cd /tmp/nixpkgs
|
||||||
PACKAGES="${{ steps.update.outputs.updated_packages }}"
|
PACKAGES="${{ steps.update.outputs.updated_packages }}"
|
||||||
echo "Verifying builds for: $PACKAGES"
|
echo "Verifying builds for: $PACKAGES"
|
||||||
|
|
||||||
@@ -171,6 +189,7 @@ jobs:
|
|||||||
- name: Push branch and create pull request
|
- name: Push branch and create pull request
|
||||||
if: steps.update.outputs.has_updates == 'true'
|
if: steps.update.outputs.has_updates == 'true'
|
||||||
run: |
|
run: |
|
||||||
|
cd /tmp/nixpkgs
|
||||||
BRANCH="${{ steps.update.outputs.branch_name }}"
|
BRANCH="${{ steps.update.outputs.branch_name }}"
|
||||||
PACKAGES="${{ steps.update.outputs.updated_packages }}"
|
PACKAGES="${{ steps.update.outputs.updated_packages }}"
|
||||||
|
|
||||||
@@ -181,19 +200,27 @@ jobs:
|
|||||||
|
|
||||||
echo "Creating pull request..."
|
echo "Creating pull request..."
|
||||||
|
|
||||||
# Create pull request using tea CLI
|
# Ensure tea is available (using host package)
|
||||||
wget -q https://dl.gitea.com/tea/latest/tea-linux-amd64 -O /tmp/tea
|
if ! command -v tea &> /dev/null; then
|
||||||
chmod +x /tmp/tea
|
echo "Error: tea not found in PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Authenticate tea if needed
|
||||||
|
if ! tea login list | grep -q "code.m3ta.dev"; then
|
||||||
|
echo "Adding tea login..."
|
||||||
|
tea login add --name m3ta --url https://code.m3ta.dev --token "${{ secrets.NIX_UPDATE_TOKEN }}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Get commit messages for PR description
|
# Get commit messages for PR description
|
||||||
COMMITS=$(git log origin/master..origin/"${BRANCH}" --pretty=format:"%h %s" | sed 's/^/- /')
|
COMMITS=$(git log origin/master..origin/"${BRANCH}" --pretty=format:"%h %s" | sed 's/^/- /')
|
||||||
|
|
||||||
# Create PR
|
# Create PR
|
||||||
/tmp/tea pr create \
|
tea pr create \
|
||||||
--head "${BRANCH}" \
|
--head "${BRANCH}" \
|
||||||
--base master \
|
--base master \
|
||||||
--title "chore: update packages with nix-update" \
|
--title "chore: update packages with nix-update" \
|
||||||
--body "Automated package updates using nix-update.\n\nUpdated packages:\n${PACKAGES}\n\nCommits:\n${COMMITS}" \
|
--body "$(printf "Automated package updates using nix-update.\n\nUpdated packages:\n%s\n\nCommits:\n%s" "$PACKAGES" "$COMMITS")" \
|
||||||
--assignees m3tam3re \
|
--assignees m3tam3re \
|
||||||
--labels automated-update || echo "Failed to create PR. Please create manually."
|
--labels automated-update || echo "Failed to create PR. Please create manually."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user