From dbd8db6d48b722076f3a283a2ba2d17a9c9165ed Mon Sep 17 00:00:00 2001 From: Benjamin Jacob Reji Date: Sun, 10 Jan 2021 12:06:51 +0400 Subject: [PATCH] Add auto update GitHub Action --- .github/workflows/update-extensions.yml | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/update-extensions.yml diff --git a/.github/workflows/update-extensions.yml b/.github/workflows/update-extensions.yml new file mode 100644 index 0000000..1ec8d8e --- /dev/null +++ b/.github/workflows/update-extensions.yml @@ -0,0 +1,46 @@ +name: Update Extensions to their lastest version +on: + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '*/5 * * * *' + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Checkout@v2 + uses: actions/checkout@v2 + + - name: Setup-Python@v2 + uses: actions/setup-python@v2 + + - name: Update Extensions + run: python update.py + + - name: Commit Changes + shell: bash + run: | + git remote set-url origin ${{ secrets.ssh }} + git status + if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit -m "Auto updating extensions" + git fetch origin main + git push origin HEAD:main + else + echo "No extension updates. Exiting... "; + fi