mirror of
https://github.com/ikatyang/emoji-cheat-sheet.git
synced 2024-11-22 02:13:48 +01:00
chore: fix auto-update script
This commit is contained in:
parent
1b253a766f
commit
bbc2250bf5
26
.github/workflows/update.yml
vendored
26
.github/workflows/update.yml
vendored
@ -41,26 +41,12 @@ jobs:
|
|||||||
script: |
|
script: |
|
||||||
const {owner, repo} = context.repo
|
const {owner, repo} = context.repo
|
||||||
const branch = 'github-actions-auto-update'
|
const branch = 'github-actions-auto-update'
|
||||||
const {status: branchStatus} = await github.repos.getBranch({
|
const title = 'docs(readme): update emoji-cheat-sheet'
|
||||||
owner,
|
const branchesResult = await github.repos.listBranches({ owner, repo })
|
||||||
repo,
|
if (branchesResult.status !== 200 || !branchesResult.data.find(({ name }) => name === branch)) {
|
||||||
branch,
|
|
||||||
})
|
|
||||||
if (branchStatus !== 200) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const {status, data: prs} = await github.pulls.list({
|
const prsResult = await github.pulls.list({ owner, repo, head: branch, state: 'open' })
|
||||||
owner,
|
if (prsResult.status === 200 && prsResult.data.length === 0) {
|
||||||
repo,
|
await github.pulls.create({ owner, repo, head: branch, title, base: 'master' })
|
||||||
head: branch,
|
|
||||||
state: 'open',
|
|
||||||
})
|
|
||||||
if (status === 200 && prs.length === 0) {
|
|
||||||
await github.pulls.create({
|
|
||||||
owner,
|
|
||||||
repo,
|
|
||||||
head: branch,
|
|
||||||
title: 'docs(readme): update emoji-cheat-sheet',
|
|
||||||
base: 'master',
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user