fix sync action

This commit is contained in:
Desuuuu 2021-02-06 04:46:31 +01:00
parent b4b0a1993f
commit 3b41fc1712
No known key found for this signature in database
GPG Key ID: 85943F4B2C2CE0DC
1 changed files with 36 additions and 13 deletions

View File

@ -9,19 +9,37 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Sync - name: Merge changes
uses: tgymnich/fork-sync@v1.3.0 uses: actions/github-script@v3
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.TOKEN }}
owner: KevinOConnor script: |
base: snapshot const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms))
head: master
merge_method: merge const { data: pullRequest } = await github.pulls.create({
pr_title: Upstream sync owner: context.repo.owner,
ignore_fail: false repo: context.repo.repo,
title: "Upstream sync",
head: "KevinOConnor:master",
base: "snapshot",
maintainer_can_modify: false
})
await timeout(3000)
await github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullRequest.number,
commit_title: "Merge upstream changes",
merge_method: "merge"
})
await timeout(3000)
- name: Checkout snapshot - name: Checkout snapshot
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
token: ${{ secrets.TOKEN }}
ref: snapshot ref: snapshot
- name: Generate tag parameters - name: Generate tag parameters
id: params id: params
@ -31,9 +49,11 @@ jobs:
- name: Create tag - name: Create tag
uses: actions/github-script@v3 uses: actions/github-script@v3
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.TOKEN }}
script: | script: |
const tagResponse = await github.git.createTag({ const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms))
const { data: tag } = await github.git.createTag({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
tag: "${{ steps.params.outputs.tagname }}", tag: "${{ steps.params.outputs.tagname }}",
@ -41,9 +61,12 @@ jobs:
object: "${{ steps.params.outputs.tagsha }}", object: "${{ steps.params.outputs.tagsha }}",
type: "commit" type: "commit"
}) })
await timeout(3000)
await github.git.createRef({ await github.git.createRef({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
ref: `refs/tags/${tagResponse.data.tag}`, ref: `refs/tags/${tag.tag}`,
sha: `${tagResponse.data.sha}` sha: `${tag.sha}`
}) })