This repository has been archived by the owner on Oct 29, 2024. It is now read-only.
Sync with Original Repo #277
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: Keep Fork Up-to-date | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
# scheduled once a day at midnight | |
workflow_dispatch: # click the button on Github repo! | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check for new release in fork | |
id: check_fork_release | |
run: | | |
FORK_RELEASE=$(git ls-remote --tags https://github.com/smartive/stencil-patched.git | cut -d '/' -f 3 | sort -V | tail -n 1) | |
echo "Latest fork release: $FORK_RELEASE" | |
echo "FORK_RELEASE=$FORK_RELEASE" >> $GITHUB_OUTPUT | |
- name: Check for new release in upstream | |
id: check_upstream_release | |
run: | | |
UPSTREAM_RELEASE=$(git ls-remote --tags https://github.com/ionic-team/stencil.git | cut -d '/' -f 3 | sort -V | tail -n 1) | |
echo "Latest upstream release: $UPSTREAM_RELEASE" | |
echo "UPSTREAM_RELEASE=$UPSTREAM_RELEASE" >> $GITHUB_OUTPUT | |
- name: Sync and push tags for fork | |
if: steps.check_fork_release.outputs.FORK_RELEASE != steps.check_upstream_release.outputs.UPSTREAM_RELEASE | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
#Set up Git | |
git config user.name 'CI-Robot' | |
git config user.email '[email protected]' | |
# Sync repo with upstream | |
gh repo sync | |
# Get latest upstream release tag | |
UPSTREAM_RELEASE=$(git ls-remote --tags https://github.com/ionic-team/stencil.git | cut -d '/' -f 3 | sort -V | tail -n 1) | |
# Push changes to your forked repository | |
git tag -a $UPSTREAM_RELEASE -m "Fork release $UPSTREAM_RELEASE" | |
git push | |
git push --tags | |