Skip to content

Update dependencies #44

Update dependencies

Update dependencies #44

Workflow file for this run

name: Update dependencies
on:
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- name: Check out repositoy
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Get current version
id: current-version
run: echo "::set-output name=VERSION::$(cat package.json | jq '.version')"
- name: Get new version
id: new-version
run: echo "::set-output name=VERSION::$(curl --silent "https://api.github.com/repos/WordPress/WordPress/tags" | jq -r '.[0].name')"
- name: Compare versions
id: version-compare
run: echo "::set-output name=COMMIT_MESSAGE::$(node index.js ${{ steps.current-version.outputs.VERSION }} ${{ steps.new-version.outputs.VERSION }})"
- name: Update WordPress files
if: steps.version-compare.COMMIT_MESSAGE != ''
run: |
composer require roots/wordpress
npm run build
- name: Check for changed files
if: steps.version-compare.COMMIT_MESSAGE != ''
id: changed-files-specific
uses: tj-actions/changed-files@v41
with:
files: dist/*.scss
- name: Create pull request
uses: peter-evans/create-pull-request@v4
id: cpr
if: steps.changed-files-specific.outputs.any_changed == 'true'
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: dist
labels: automerge
commit-message: ${{ steps.version-compare.COMMIT_MESSAGE }}
branch: update-${{ steps.new-version.outputs.VERSION }}
- name: Merge pull request with built assets into Dependabot branch
if: ${{ steps.cpr.outputs.pull-request-number }}
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: automerge
MERGE_METHOD: squash
PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}"