-
Notifications
You must be signed in to change notification settings - Fork 7
95 lines (88 loc) · 3.37 KB
/
dependency-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# This workflow automates theprocess of updating and creating a PR for
# NPM and and composer updates.
# currently this runs against Composer and NPM.
# please add any updates to this if you create new package files for PHP or Node based projects.
name: Update dependencies
permissions:
contents: write
security-events: read
pull-requests: write
actions: none
checks: none
deployments: none
issues: none
packages: none
repository-projects: none
statuses: none
on:
# In case we need to change, uncomment out and change name to branch you are fixing on.
# Commits will make action trigger.
# Remember to comment out after work done.
# push:
# branches:
# - dependency-issue-npm
schedule:
- cron: '0 8 * * 1' # runs on a monday morning
workflow_dispatch:
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# set up php
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
# setup node
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: '15'
# composer
- name: Update outdated dependencies - composer
run: |
echo "running composer updates..."
cd service-front
composer update --prefer-dist --no-interaction --no-scripts --optimize-autoloader --ignore-platform-reqs
cd ../service-api
composer update --prefer-dist --no-interaction --no-scripts --optimize-autoloader --ignore-platform-reqs
cd ../service-admin
composer update --prefer-dist --no-interaction --no-scripts --optimize-autoloader --ignore-platform-reqs
cd ../service-pdf
composer update --prefer-dist --no-interaction --no-scripts --optimize-autoloader --ignore-platform-reqs
# npm
- name: Update outdated dependencies - npm
run: |
echo "running npm updates..."
npm update -f
cd service-front
npm update -f
# create a datestamp for the branch
- name: Get current time
uses: srfrnk/current-time@master
id: current-time
with:
format: DD-MM-YYYY
- name: Check value of branch name
run: echo "branch name to be created $BRANCH_NAME"
env:
BRANCH_NAME: "weekly-dependency-updates-${{ steps.current-time.outputs.formattedTime }}"
# create PR
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update dependencies for composer and npm
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: weekly-dependency-updates-${{ steps.current-time.outputs.formattedTime }}
labels: dependency-update
title: Weekly dependencies update ${{ steps.current-time.outputs.formattedTime }}
body: |
**WEEKLY DEPENDENCIES UPDATES (${{ steps.current-time.outputs.formattedTime }})**
This automated PR covers:
- PHP `Composer`
- `NPM`