Skip to content

Automation for AUR publishing#3

Closed
prabinpanta0 wants to merge 3 commits intomasterfrom
main
Closed

Automation for AUR publishing#3
prabinpanta0 wants to merge 3 commits intomasterfrom
main

Conversation

@prabinpanta0
Copy link
Copy Markdown
Owner

This pull request introduces a new GitHub Actions workflow for automating pushes to the AUR repository whenever changes are merged into the main branch. The workflow securely sets up SSH access, ensures the AUR host key is present, and robustly pushes updates to the AUR, with fallback logic for force-with-lease pushes if needed.

Automation for AUR publishing:

  • Added .github/workflows/push-to-aur.yml to automate pushing the main branch to the AUR master branch on every push, including robust fallback handling for push failures.
  • Configured secure SSH setup using GitHub secrets and ensured the AUR host key is present before pushing.

Copilot AI review requested due to automatic review settings February 6, 2026 08:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

A new GitHub Actions workflow is added to automatically push the main branch to the AUR (Arch User Repository) master branch. The workflow sets up SSH authentication, configures Git, and implements a push strategy with fallback retry logic using force-with-lease if the initial push fails.

Changes

Cohort / File(s) Summary
AUR Push Workflow
.github/workflows/push-to-aur.yml
New GitHub Actions workflow triggered on main branch pushes. Performs SSH authentication, Git configuration, and pushes main to AUR master with conditional force-with-lease retry mechanism.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A workflow hops through the main,
SSH keys unlock the AUR domain,
Push and retry, with force-with-lease grace,
The package now finds its rightful place!
Automated pipelines, hopping with care,
Making distributions everywhere! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding automation for AUR publishing via a GitHub Actions workflow.
Description check ✅ Passed The description directly relates to the changeset, detailing the new GitHub Actions workflow for automating AUR pushes with secure SSH setup and fallback logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch main

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces automation for publishing the Aeth shell project to the Arch User Repository (AUR) via a GitHub Actions workflow. The workflow automatically pushes changes from the main branch to the AUR repository's master branch whenever code is merged to main.

Changes:

  • Added .github/workflows/push-to-aur.yml workflow to automate AUR publishing with SSH authentication and fallback push logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +5
on:
push:
branches: ["main"]
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow triggers on every push to main, which means it will attempt to push to AUR even if the push doesn't contain changes to AUR-related files (PKGBUILD, .SRCINFO, etc.). Consider adding a path filter to only trigger when AUR-related files are modified, or adding a condition to check if relevant files have changed before pushing. This would avoid unnecessary AUR updates and potential confusion.

Copilot uses AI. Check for mistakes.
exit 0
fi
echo "Regular push failed, fetching remote and attempting force-with-lease push"
git fetch aur master || true
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git fetch aur master || true on line 40 silences fetch errors, but the subsequent --force-with-lease push on line 41 relies on having up-to-date remote refs. If the fetch fails, the force-with-lease push may not behave as intended (it could fail or force-push when it shouldn't). Consider removing the || true from the fetch command and handling the fetch failure explicitly, or adding a check to verify the fetch succeeded before attempting the force-with-lease push.

Suggested change
git fetch aur master || true
git fetch aur master

Copilot uses AI. Check for mistakes.
- name: Ensure AUR host key
run: |
mkdir -p ~/.ssh
ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ssh-keyscan without verifying the fingerprint could expose the workflow to man-in-the-middle attacks. While this is common practice in CI/CD, consider hardcoding the known AUR host key fingerprint instead of dynamically scanning. You can obtain the official fingerprint from AUR documentation and add it directly to known_hosts for better security assurance.

Suggested change
ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
# NOTE: Replace the placeholder key below with the official AUR SSH host key
# obtained from AUR/Arch Linux documentation or another trusted source.
# Format: "<hostname> <keytype> <base64-encoded-key>"
echo "aur.archlinux.org ssh-ed25519 AAAA_REPLACE_WITH_OFFICIAL_AUR_HOST_KEY_FROM_AUR_DOCS" >> ~/.ssh/known_hosts

Copilot uses AI. Check for mistakes.
@prabinpanta0 prabinpanta0 marked this pull request as draft February 6, 2026 08:36
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/push-to-aur.yml:
- Around line 39-41: The fallback push currently does a `git fetch aur master`
followed immediately by `git push aur main:master --force-with-lease`, which
nullifies the lease protection; either make the intent explicit by changing the
push to an unconditional force (`git push aur main:master --force`) so the
fallback truly force-pushes, or preserve `--force-with-lease` safety by removing
the `git fetch aur master` step so the lease comparison uses the existing local
tracking ref (and handle the case where the runner has no tracking ref). Update
the commands accordingly around the `git fetch aur master` and `git push aur
main:master --force-with-lease` lines to reflect the chosen behavior.
🧹 Nitpick comments (3)
.github/workflows/push-to-aur.yml (3)

7-10: Add a permissions block to follow the principle of least privilege.

This workflow only needs to read repository contents. Without an explicit permissions block, the GITHUB_TOKEN receives the repository's default permissions, which are often broader than necessary. Restricting permissions limits blast radius if the workflow or a dependency is compromised.

🛡️ Suggested fix
 jobs:
     push-to-aur:
         runs-on: ubuntu-latest
+        permissions:
+            contents: read
         steps:

33-33: git remote add … || true silently ignores a stale or mismatched remote URL.

On GitHub-hosted runners this is fine (fresh environment each time), but if the workflow ever runs on a self-hosted or cached runner, a pre-existing aur remote with a different URL would be silently reused. A safer pattern:

Suggested fix
-                  git remote add aur "$AUR_REPO" || true
+                  git remote add aur "$AUR_REPO" 2>/dev/null || git remote set-url aur "$AUR_REPO"

11-17: Pin actions to commit SHAs instead of mutable version tags, and update webfactory/ssh-agent to latest.

Both actions/checkout@v4 and webfactory/ssh-agent@v0.8.1 use mutable tags, which introduces supply-chain risk if a tag is compromised or force-pushed. GitHub's official security hardening guidance recommends pinning to full commit SHAs (e.g., actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7).

Additionally, webfactory/ssh-agent@v0.8.1 is outdated; the latest version is v0.9.1 (released Mar 2025). Given GitHub's deprecation of Node 20 (effective Mar 4, 2026), upgrading to the latest release ensures compatibility with current and future runner defaults.

Comment on lines +39 to +41
echo "Regular push failed, fetching remote and attempting force-with-lease push"
git fetch aur master || true
git push aur main:master --force-with-lease
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

--force-with-lease immediately after git fetch offers no protection — it behaves like --force.

--force-with-lease guards against overwriting unknown remote changes by comparing the remote ref to the locally cached tracking ref. After git fetch aur master on Line 40, the local aur/master is updated to the current remote state, so the lease check always passes — making this equivalent to --force.

If the intent is a genuine force-push fallback, be explicit:

Suggested fix
                  echo "Regular push failed, fetching remote and attempting force-with-lease push"
-                  git fetch aur master || true
-                  git push aur main:master --force-with-lease
+                  # Force push as fallback — regular push failed (e.g. history diverged).
+                  # This is intentional for AUR sync where main is the source of truth.
+                  git push aur main:master --force

If you actually want the safety of --force-with-lease, do not fetch before the push so the lease comparison uses a stale (or absent) local ref. But note that on a fresh GitHub-hosted runner the tracking ref won't exist at all, so --force-with-lease without a prior fetch would also fail for a different reason.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "Regular push failed, fetching remote and attempting force-with-lease push"
git fetch aur master || true
git push aur main:master --force-with-lease
echo "Regular push failed, fetching remote and attempting force-with-lease push"
# Force push as fallback — regular push failed (e.g. history diverged).
# This is intentional for AUR sync where main is the source of truth.
git push aur main:master --force
🤖 Prompt for AI Agents
In @.github/workflows/push-to-aur.yml around lines 39 - 41, The fallback push
currently does a `git fetch aur master` followed immediately by `git push aur
main:master --force-with-lease`, which nullifies the lease protection; either
make the intent explicit by changing the push to an unconditional force (`git
push aur main:master --force`) so the fallback truly force-pushes, or preserve
`--force-with-lease` safety by removing the `git fetch aur master` step so the
lease comparison uses the existing local tracking ref (and handle the case where
the runner has no tracking ref). Update the commands accordingly around the `git
fetch aur master` and `git push aur main:master --force-with-lease` lines to
reflect the chosen behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants