Skip to content

Update C workflow

Update C workflow #14

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@v6
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 updates',
owner: owner,
repo: repo,
head: context.ref,
base: 'main',
body: [
'This PR is auto-generated by',
'[actions/github-script](https://github.com/actions/github-script)',
].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'),
});
}