This commit is contained in:
m3tm3re
2026-01-18 07:04:49 +01:00
parent 80347f4915
commit db2596b1f8

View File

@@ -15,6 +15,9 @@ env:
GIT_AUTHOR_EMAIL: "bot@m3ta.dev" GIT_AUTHOR_EMAIL: "bot@m3ta.dev"
GIT_COMMITTER_NAME: "nix-update bot" GIT_COMMITTER_NAME: "nix-update bot"
GIT_COMMITTER_EMAIL: "bot@m3ta.dev" GIT_COMMITTER_EMAIL: "bot@m3ta.dev"
# Global environment variables to prevent interactive prompts in any step
GIT_TERMINAL_PROMPT: "0"
GIT_ASKPASS: "/bin/echo"
jobs: jobs:
nix-update: nix-update:
@@ -28,10 +31,6 @@ jobs:
rm -rf /tmp/nixpkgs rm -rf /tmp/nixpkgs
fi fi
# Disable terminal prompts for all git operations
export GIT_TERMINAL_PROMPT=0
export GIT_ASKPASS="/bin/echo"
# Clone repository with token authentication # Clone repository with token authentication
git clone --no-single-branch \ git clone --no-single-branch \
"https://${{ secrets.NIX_UPDATE_TOKEN }}@code.m3ta.dev/m3tam3re/nixpkgs.git" \ "https://${{ secrets.NIX_UPDATE_TOKEN }}@code.m3ta.dev/m3tam3re/nixpkgs.git" \
@@ -210,10 +209,13 @@ jobs:
BRANCH="${{ steps.update.outputs.branch_name }}" BRANCH="${{ steps.update.outputs.branch_name }}"
PACKAGES="${{ steps.update.outputs.updated_packages }}" PACKAGES="${{ steps.update.outputs.updated_packages }}"
echo "Pushing branch ${BRANCH}..." echo "Configuring git push authentication..."
# Ensure the remote URL has the token to prevent interactive prompts
git remote set-url origin "https://${{ secrets.NIX_UPDATE_TOKEN }}@code.m3ta.dev/m3tam3re/nixpkgs.git"
# Push the branch echo "Pushing branch ${BRANCH}..."
git push origin "${BRANCH}" || (git fetch origin "${BRANCH}" 2>/dev/null && git push origin "${BRANCH}" --force) # Force push if needed (though branch is new)
git push origin "${BRANCH}"
echo "Creating pull request..." echo "Creating pull request..."
@@ -222,14 +224,16 @@ jobs:
exit 1 exit 1
fi fi
# Authenticate tea if needed # Remove existing tea login to ensure we use the fresh token
if ! tea login list | grep -q "code.m3ta.dev"; then # We ignore errors in case the login doesn't exist
echo "Adding tea login..." tea login delete m3ta >/dev/null 2>&1 || true
tea login add --name m3ta --url https://code.m3ta.dev --token "${{ secrets.NIX_UPDATE_TOKEN }}"
fi # Add tea login with the secret token
echo "Adding tea login..."
tea login add --name m3ta --url https://code.m3ta.dev --token "${{ secrets.NIX_UPDATE_TOKEN }}"
# Get commit messages # Get commit messages
COMMITS=$(git log origin/master..origin/"${BRANCH}" --pretty=format:"%h %s" | sed 's/^/- /') COMMITS=$(git log origin/master..HEAD --pretty=format:"%h %s" | sed 's/^/- /')
# Create PR # Create PR
tea pr create \ tea pr create \