Sync updates from external repos #658
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: Sync updates from external repos | |
on: | |
schedule: | |
- cron: '0 */1 * * *' | |
jobs: | |
default: | |
name: Open PR from forked/develop to origin/develop | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write # for opening PR | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Open PR from forked repo to origin one | |
if: vars.EXTERNAL_REPO != '' | |
uses: actions/script@v6 | |
with: | |
script: | | |
github.rest.pulls.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
base: 'develop', | |
head_repo: process.env.REPO, | |
head: `develop`, | |
title: `Merge ${process.env.REPO}:develop to develop`, | |
body: `Ready to deploy`, | |
}).catch(async res => { | |
const content = await res.json() | |
if (content.message.includes('No commits between')) { | |
return | |
} | |
throw new Error(content.message) | |
}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO: ${{ vars.EXTERNAL_REPO }} |