-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
69 lines (66 loc) · 2.54 KB
/
action.yaml
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
name: 'Composer update'
description: 'Runs a composer update such that you can create a PR if there are any updates'
inputs:
working-dir:
description: 'Directory of the composer.lock'
required: true
default: './'
composer-token:
description: 'API token for composer'
required: true
composer-cache:
description: 'Path to composer cache'
required: true
default: /tmp/composer-cache
composer-arguments:
description: 'Additional composer arguments'
required: true
default: --ignore-platform-req=ext-grpc
check-outdated:
description: 'Check if we should return the outdated packages'
required: true
default: '0'
outputs:
diff:
description: "Markdown table with the changed versions"
value: ${{ steps.get-diff.outputs.diff }}
outdated:
description: "Script output with the outdated packages that are left after updating"
value: ${{ steps.get-outdated.outputs.outdated }}
runs:
using: "composite"
steps:
- name: Install dependencies
shell: bash
run: composer install --no-progress --no-scripts --no-autoloader -d ${{ inputs.working-dir }} ${{ inputs.composer-arguments }}
env:
COMPOSER_CACHE_DIR: ${{ inputs.composer-cache }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ inputs.composer-token }}"}}'
- name: Update dependencies
shell: bash
run: composer update --no-progress --no-scripts --no-autoloader -d ${{ inputs.working-dir }} ${{ inputs.composer-arguments }}
env:
COMPOSER_CACHE_DIR: ${{ inputs.composer-cache }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ inputs.composer-token }}"}}'
- name: Create diff
id: get-diff
shell: bash
run: |
composer global require davidrjonas/composer-lock-diff:^1.0
diff=$(~/.composer/vendor/bin/composer-lock-diff --md -p ${{ inputs.working-dir }})
diff="${diff//'%'/'%25'}"
diff="${diff//$'\n'/'%0A'}"
diff="${diff//$'\r'/'%0D'}"
echo "::set-output name=diff::$diff"
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ inputs.composer-token }}"}}'
- name: Check outdated
id: get-outdated
shell: bash
run: |
[ "${{ inputs.check-outdated }}" = "1" ] && outdated=$(composer outdated -d ${{ inputs.working-dir }})
outdated="${outdated//$'\n'/'\n'}"
echo "::set-output name=outdated::$outdated"
env:
COMPOSER_CACHE_DIR: ${{ inputs.composer-cache }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ inputs.composer-token }}"}}'