How to have an agent upgrade dependencies every night and open PRs
Create an On a schedule automation that runs every night, give it the list of repositories, and tell the agent to upgrade within your version policy, run the tests, and open one pull request per repository. Each night Nori starts the agent on a fresh cloud machine with your repositories already cloned, and the run’s summary lands in Slack or in the automation’s history.
Prerequisites
Section titled “Prerequisites”- The GitHub App installed with access to every repository in scope, and the repositories added under Settings → Environment so each machine starts with them.
- A setup script (Settings → Environment → Setup script & tools) that installs the toolchains your tests need, for example Node and Python.
- A connected agent under Integrations → Token providers.
- Optional: the Nori Slack app and a channel such
as
#deps, with its channel ID, for a nightly summary thread. - Branch protection and CI on each repository, so upgrade pull requests are checked and reviewed before merging.
- Open Automations → New automation and name it
Nightly dependency upgrades. - Under Starts when, choose On a schedule, then Daily under Schedule. Set Time to a quiet hour such as 02:00 and Timezone to your IANA zone.
- Write the Instructions (see the example): the repositories, the version policy, the test command, and what to do when tests fail.
- Under Deliver to, choose Slack thread for a nightly summary your team can reply to, or Standalone session to keep results in the automation’s history only.
- Optional: for heavy test suites, run on a larger machine. Add
--size largewhen you create it from the CLI, or under Run with pick a custom agent that has a larger machine size. - Save with Create or Submit for approval.
Example
Section titled “Example”nori-sessions triggers create \ --name "Nightly dependency upgrades" \ --type cron \ --cron-schedule "0 2 * * *" \ --timezone America/New_York \ --slack-channel-id C0123456789 \ --prompt "For each of these repositories: api, web, worker.1. If an open pull request from a previous night's upgrade exists, update that branch instead of opening another.2. Upgrade dependencies to the newest versions allowed by the current version ranges (patch and minor only). Update the lockfile.3. Run the repository's test suite.4. If tests pass, open a pull request titled 'chore(deps): nightly upgrade' listing each package and version change. Never merge.5. If tests fail, find which upgrade broke them, leave that package at its old version, and say why in the pull request.Reply with one line per repository: PR link, packages upgraded, tests."Major-version upgrades work the same way; give them their own weekly automation so their pull requests get a separate, slower review.
Verify it works
Section titled “Verify it works”- Choose Run now on the automation (CLI:
nori-sessions triggers test --id <id>) instead of waiting for 02:00. - Check GitHub for one upgrade pull request per repository, with CI running.
- Read the Slack thread, or Recent activity → Last response, for the per-repository summary.
- The next morning, check that the scheduled run fired: Recent activity shows its time and Succeeded or Failed. Runs stop at the automation time limit (6 hours by default), and a failing automation posts a notice in its origin channel.
See automations for schedules, retries, and time limits.
this page as markdown: /sessions/recipes/nightly-dependency-upgrades.md· index for agents: /llms.txt