proud-policeman-38871
11/11/2024, 11:22 AMfix(deps):
• updates lockfiles with pants generate-lockfiles
• If our lockfile (3rdparty/python/default.lock
) has changed, commit it
This is a rough draft, and I'd love to know if people have better ideas or places where we can improve this, but at this point, it got me past stakeholder concerns and is working.
🧵proud-policeman-38871
11/11/2024, 11:23 AM---
name: Update lockfiles when dependencies change is merged
on:
pull_request:
branches: [main]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
update-lockfiles:
name: update-lockfiles
runs-on: arc-runner-set
if: |
contains(github.event.pull_request.title, 'chore(deps)') ||
contains(github.event.pull_request.title, 'fix(deps)')
outputs:
AFFECTED_PROJECTS: ${{ steps.get_affected_projects.outputs.AFFECTED_PROJECTS }}
CHANGE_BASE: ${{ steps.set-change-base.outputs.CHANGE_BASE }}
env:
AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
with:
gha-cache-key: cache0-py3.12
- name: Update lockfiles
run: |
pants generate-lockfiles
- name: Commit changes
run: |
git switch ${GITHUB_HEAD_REF}
CHANGES_NEEDED=$(git status --porcelain | grep "python/default.lock" | wc -l)
if [ "${CHANGES_NEEDED}" -lt 1 ]; then
echo "No changes to lockfile - not pushing change"
else
git config --global user.name "github-actionspantslockfilebot"
git config --global user.email "<mailto:github-actionsactionspantslockfilebot@users.noreply.github.com|github-actionsactionspantslockfilebot@users.noreply.github.com>"
git add 3rdparty/python/default.lock
git commit -m "Update python lockfile with dependency change"
git push origin HEAD:${GITHUB_HEAD_REF}
fi
dazzling-pizza-75442
11/11/2024, 1:34 PMproud-policeman-38871
11/11/2024, 1:36 PMpants
is available for that to run successfully please?dazzling-pizza-75442
11/11/2024, 1:43 PMwhich pants || ./get-pants.sh
before running pants generate-lockfiles
proud-policeman-38871
11/11/2024, 1:45 PMproud-policeman-38871
11/11/2024, 2:11 PMdazzling-pizza-75442
11/11/2024, 2:17 PMdazzling-pizza-75442
11/11/2024, 2:17 PMdazzling-pizza-75442
11/11/2024, 2:18 PMproud-policeman-38871
11/11/2024, 2:18 PMdazzling-pizza-75442
11/11/2024, 2:19 PMproud-policeman-38871
11/11/2024, 2:19 PMcareful-address-89803
11/21/2024, 2:40 AMproud-policeman-38871
11/21/2024, 9:48 AM/home/ubuntu/.local/bin/pants generate-lockfiles
proud-policeman-38871
11/21/2024, 9:49 AMproud-policeman-38871
11/21/2024, 9:49 AMcareful-address-89803
11/21/2024, 6:35 PM{
"packageRules": [{
"groupName": "Python",
"groupSlug": "python",
"matchDataSources": ["pypi"],
"postUpgradeTasks": {
"commands": ["pants generate-lockfiles --resolve=python-default"],
"executionMode": "branch"
}]
}
(Rip formatting I'm on mobile)