Update to use the latest version of eye #2567
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: Update to use the latest version of eye | |
on: | |
schedule: | |
- cron: '0 */2 * * *' | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Commit latest release version | |
run: | | |
npm ci | |
# Get version of EYE before any updates are run | |
before=$(cat ./package.json | jq .config.eye.name) | |
npm run eye:update | |
# Version of EYE after getting updates | |
current=$(cat ./package.json | jq .config.eye.name) | |
readarray -d . -t before <<<"${before:2:-1}" | |
readarray -d . -t after <<<"${current:2:-1}" | |
if [ ! ${before[0]} == ${after[0]} ]; then | |
version="BREAKING CHANGE" | |
branchHead="breaking" | |
elif [ ! ${before[1]} == ${after[1]} ]; then | |
version="feat" | |
branchHead="feat" | |
elif [ ! ${before[2]} == ${after[2]} ]; then | |
version="fix" | |
branchHead="fix" | |
fi | |
# The name of the new branch if we need to create one | |
branch=$branchHead/update-eye-${current:1:-1} | |
msg="$version: update to eye ${current:1:-1}" | |
if [ $branchHead ]; then | |
git config --global user.name 'Jesse Wright' | |
git config --global user.email '[email protected]' | |
git checkout -b $branch | |
git commit -am "$msg" | |
git push --set-upstream origin $branch | |
gh pr create -t "$msg" -b "$msg" | |
if [ ! $branchHead == "breaking" ]; then | |
gh pr merge $branch --auto --squash | |
fi | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} |