Update to use the latest version of eye #8428
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 | |
strategy: | |
matrix: | |
dep: [eye, lingua] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Commit latest release version | |
run: | | |
npm ci | |
# Get version of EYE before any updates are run | |
before=$(cat ./package.json | jq '.config."${{ matrix.dep }}".name') | |
npm run ${{ matrix.dep }}:update | |
# Version of EYE after getting updates | |
current=$(cat ./package.json | jq '.config."${{ matrix.dep }}".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-${{ matrix.dep }}-${current:1:-1} | |
msg="$version: update to ${{ matrix.dep }} ${current:1:-1}" | |
if [ $branchHead ]; then | |
git config --global user.name 'Jesse Wright' | |
git config --global user.email '63333554+jeswr@users.noreply.github.com' | |
git checkout -b $branch | |
git commit -am "$msg" -n | |
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 }} |