more package docs #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | |
}); | |
} |