Skip to content

chore(deps): update dependency tsx to v4.16.3 #70

chore(deps): update dependency tsx to v4.16.3

chore(deps): update dependency tsx to v4.16.3 #70

Workflow file for this run

name: deps-sync
on:
push:
branches:
- main
- deps
- deps-sync
- 'deps-sync/**'
jobs:
run:
runs-on: ubuntu-latest
steps:
- id: branches
name: Set branch variables
# hardcoded, but stored in a variable to make it less painful to change to `master`/`dependencies` or whatever
run: |
echo deps_branch=deps >> $GITHUB_ENV
echo main_branch=main >> $GITHUB_ENV
cp $GITHUB_ENV $GITHUB_OUTPUT
- name: checkout ${{ steps.branches.outputs.deps_branch }}
uses: actions/checkout@v4
with:
ref: ${{ steps.branches.outputs.deps_branch }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git # needed to author commits
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Merge in latest ${{ steps.branches.outputs.main_branch }}
run: |
git fetch
git merge --strategy-option theirs origin/$main_branch
- name: Update lockfile # main may have updated dependencies too, so make sure lockfile is valid. This is a no-op if there are no changes.
run: |
corepack enable
pnpm install --no-frozen-lockfile
- name: Commit lockfile changes
id: commit_changes
run: |
git status
GIT_STATUS=$(git status --porcelain)
if [ -z "$GIT_STATUS" ]; then
echo "no working changes, nothing to commit"
else
echo changes=yes >> $GITHUB_OUTPUT
git add .
git commit -m 'chore: changes after pnpm install' --no-verify
fi
- name: Push changes
id: push_changes
run: |
is_ahead=$(git status | grep 'Your branch is ahead' || echo '')
if [ -z "$is_ahead" ]; then
git status
echo "no changes to push"
else
echo ahead=yes >> $GITHUB_OUTPUT
git push
fi
- name: Check if ${{ steps.branches.outputs.deps_branch }} branch is ahead of ${{ steps.branches.outputs.main_branch }}
id: deps_diff
run: |
git checkout $main_branch
git pull
diff=$(git diff $deps_branch)
if [ -z "$diff" ]; then
echo "no diff between $main_branch and $deps_branch"
echo status=clean >> $GITHUB_OUTPUT
else
echo "diff between $main_branch and $deps_branch:"
echo "$diff"
echo status=dirty >> $GITHUB_OUTPUT
fi
- name: Reset deps branch
if: steps.deps_diff.outputs.status == 'clean'
run: |
git checkout $deps_branch
git diff $main_branch --exit-code
git fetch origin
git reset --hard origin/$main_branch
git push --force-with-lease origin $deps_branch
- name: Create pull request
if: steps.deps_diff.outputs.status == 'dirty'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const iterator = github.paginate.iterator(github.rest.pulls.list, {
...context.repo,
state: 'open',
})
const {deps_branch: head, main_branch: base} = process.env
for await (const {data: pulls} of iterator) {
const existing = pulls.find(p => p.head.ref === head && p.base.ref === base)
if (existing) {
console.log(`Pull request into ${base} from ${head} already exists: ${existing.title} ${existing.html_url}`)
return
}
}
await github.rest.pulls.create({
...context.repo,
head,
base,
title: 'chore: update dependencies',
body: [
'This PR was automatically created by the ${{ github.workflow }} workflow.',
'',
`Renovate will continue to push to ${head}.`,
'',
'Review each dependency update and merge as needed.',
].join('\n'),
})