Skip to content

Cron Update Modules #126

Cron Update Modules

Cron Update Modules #126

Workflow file for this run

name: Cron Update Modules
on:
schedule:
- cron: '0 23 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
update-composer-modules:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
runs-on: ubuntu-latest
name: Update Modules
steps:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout PrestaShop
uses: actions/checkout@v4
with:
repository: PrestaShop/PrestaShop
fetch-depth: 1
path: prestashop
ref: develop
- name: Install NPM dependencies
run: npm ci
- name: Execute script for updating modules
run: npm run --silent check:data:modules > cron_php_update_modules.txt
- name: Remove prestashop directory
run: rm -rf ./prestashop/
- name: Update PrestaShop packages
id: updated-packages
run: |
if [[ -f cron_php_update_modules.txt ]]; then
FILE_CONTENT=$(cat cron_php_update_modules.txt)
echo PR_BODY=$FILE_CONTENT >> $GITHUB_OUTPUT
rm cron_php_update_modules.txt
else
echo 'Nothing to update'
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
if: ${{steps.updated-packages.outputs.PR_BODY}} != ''
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: cron-php-update-modules
commit-message: '`@data/demo/modules`: Update modules'
title: '`@data/demo/modules`: Update modules'
body: ${{steps.updated-packages.outputs.PR_BODY}}
base: main
delete-branch: true