Dependency Manager workflow (ajndkr/lanarky)
The Dependency Manager workflow from ajndkr/lanarky, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Dependency Manager workflow from the ajndkr/lanarky repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Dependency Manager
on:
workflow_dispatch: # Allow running on-demand
schedule:
# Every first day of the month at 1PM UTC
- cron: 0 13 1 * *
env:
PYTHON_VERSION: 3.9
jobs:
upgrade:
name: Weekly dependency upgrade
runs-on: ubuntu-latest
env:
BRANCH_NAME: deps/weekly-upgrade
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Upgrade base dependencies
run: |
pip install -U poetry
poetry update
- name: Upgrade pre-commit hooks
run: |
pip install pre-commit
pre-commit autoupdate
- name: Detect changes
id: changes
run: echo "count=$(git status --porcelain=v1 2>/dev/null | wc -l)" >> $GITHUB_OUTPUT
- name: Commit & push changes
if: steps.changes.outputs.count > 0
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add .
git commit -m "build(deps): upgrade dependencies"
git push -f origin ${{ github.ref_name }}:$BRANCH_NAME
- name: Open pull request
if: steps.changes.outputs.count > 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR=$(gh pr list --head $BRANCH_NAME --json number -q '.[0].number')
if [ -z $PR ]; then
gh pr create \
--draft \
--head $BRANCH_NAME \
--title "build(deps): upgrade dependencies" \
--body "Full log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--label "dependencies"
else
echo "Pull request already exists, won't create a new one."
fi
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: Dependency Manager on: workflow_dispatch: # Allow running on-demand schedule: # Every first day of the month at 1PM UTC - cron: 0 13 1 * * env: PYTHON_VERSION: 3.9 jobs: upgrade: timeout-minutes: 30 name: Weekly dependency upgrade runs-on: latchkey-small env: BRANCH_NAME: deps/weekly-upgrade steps: - name: Code checkout uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v4 with: cache: 'pip' python-version: ${{ env.PYTHON_VERSION }} - name: Upgrade base dependencies run: | pip install -U poetry poetry update - name: Upgrade pre-commit hooks run: | pip install pre-commit pre-commit autoupdate - name: Detect changes id: changes run: echo "count=$(git status --porcelain=v1 2>/dev/null | wc -l)" >> $GITHUB_OUTPUT - name: Commit & push changes if: steps.changes.outputs.count > 0 run: | git config user.name "github-actions" git config user.email "github-actions@github.com" git add . git commit -m "build(deps): upgrade dependencies" git push -f origin ${{ github.ref_name }}:$BRANCH_NAME - name: Open pull request if: steps.changes.outputs.count > 0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PR=$(gh pr list --head $BRANCH_NAME --json number -q '.[0].number') if [ -z $PR ]; then gh pr create \ --draft \ --head $BRANCH_NAME \ --title "build(deps): upgrade dependencies" \ --body "Full log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ --label "dependencies" else echo "Pull request already exists, won't create a new one." fi
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.