Skip to content

Simplify dependency updates workflow #161

Simplify dependency updates workflow

Simplify dependency updates workflow #161

Workflow file for this run

name: Auto PR
on:
push:
branches:
- 'autopr/**'
permissions: read-all
jobs:
create-pull-request:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Create PR
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const pulls = await github.rest.pulls.list({
owner: owner,
repo: repo,
head: context.ref,
base: 'main',
state: 'open',
});
if (pulls.data.length < 1) {
await github.rest.pulls.create({
title: '[AUTOPR] Automatic Update',
owner: owner,
repo: repo,
head: context.ref,
base: 'main',
body: [
'Automatic PR:',
'- Update dependencies',
].join('\n'),
});
} else {
const existingPR = pulls.data[0];
await github.rest.pulls.update({
owner: owner,
repo: repo,
pull_number: existingPR.number,
body: [
existingPR.body,
`Updated by Job ${context.job}`,
].join('\n'),
});
}