From 675bc7866497af0aa474d9f431c573c0bc3a1422 Mon Sep 17 00:00:00 2001 From: Dani Perez Date: Mon, 14 Aug 2023 20:39:31 +0200 Subject: [PATCH] [wip] version checks --- .github/workflows/check-vale-update.yml | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/check-vale-update.yml diff --git a/.github/workflows/check-vale-update.yml b/.github/workflows/check-vale-update.yml new file mode 100644 index 0000000..0f2aa2d --- /dev/null +++ b/.github/workflows/check-vale-update.yml @@ -0,0 +1,40 @@ +name: Schedule Commit + +on: + # schedule: + # - cron: '0 0 * * *' # This schedule runs every day at midnight UTC + push: + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + update-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check Vale's last version + run: | + VALE_LAST_VERSION=$(gh release list -L 1 -R errata-ai/vale | cut -d " " -f 1 | tr "v" "") + VALE_PYTHON_LAST_VERSION=$(cat pyproject.toml | grep "^version =" | cut -d "\"" -f 2 | sed "s/\.[^.]*$//" | cut -d "." -f -3) + echo "Current Vale version : $VALE_LAST_VERSION" + echo "Current Python Vale version : $VALE_PYTHON_LAST_VERSION" + + if [[ "$VALE_LAST_VERSION" == "$VALE_PYTHON_LAST_VERSION" ]]; then + echo "Same versions 🎉" + gh run cancel ${{ github.run_id }} + gh run watch ${{ github.run_id }} + else + if [ -n "$VALE_LAST_VERSION" ]; # not-empty + echo "Versions differ, updating." + echo "VALE_LAST_VERSION=$VALE_LAST_VERSION" >> $GITHUB_OUTPUT + fi + + # - name: Version bump + # if: ${{ success() }} + # run: | + # # Commit version bump (change pyproject.yaml, CHANGELOG and README.md): + # # VALE_LAST_VERSION=${{ steps.vars.outputs.VALE_LAST_VERSION }}