-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
70 lines (57 loc) · 3.12 KB
/
action.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
name: 'Private Packagist Conductor'
description: 'GitHub Action to integrate Private Packagist Conductor with your CI'
author: Packagist Conductors GmbH <[email protected]>
inputs:
file_pattern:
description: The file pattern used for `git add`. For example `composer.*`
default: '.'
required: false
runs:
using: "composite"
steps:
- name: "Validate GitHub action version"
shell: "bash"
run: "${GITHUB_ACTION_PATH}/bin/ci_version_check.sh ${{ github.event.client_payload.requirements.minimumCiActionVersion }} 0.1"
- name: "Validate PHP version"
shell: "bash"
run: "${GITHUB_ACTION_PATH}/bin/php_version_check.sh ${{ github.event.client_payload.requirements.minimumPhpVersion }}"
- name: "Validate Composer version"
shell: "bash"
run: "${GITHUB_ACTION_PATH}/bin/composer_version_check.sh ${{ github.event.client_payload.requirements.minimumComposerVersion }}"
- name: Install dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a # 3.0.0
with:
working-directory: "${{ github.event.client_payload.workingDirectory }}"
- name: Composer update
run: "${{ github.event.client_payload.updateCommand.plain }}"
shell: bash
working-directory: "${{ github.event.client_payload.workingDirectory }}"
- name: Create branch
run: git checkout -b $BRANCH
shell: bash
env:
BRANCH: ${{ github.event.client_payload.branch }}
- name: Add files
run: |
read -r -a PATTERN_EXPANDED <<< "$FILE_PATTERN";
git add ${FILE_PATTERN:+"${PATTERN_EXPANDED[@]}"};
shell: bash
env:
FILE_PATTERN: ${{ inputs.file_pattern }}
- name: Commit
uses: qoomon/actions--create-commit@dfef4d264de752be6d6195a4d61a2f3d3262d406 # v1.2.3
with:
message: ${{ github.event.client_payload.commitMessage }}
skip-empty: true
- name: Push branch
run: git push origin $BRANCH --force
shell: bash
env:
BRANCH: ${{ github.event.client_payload.branch }}
- name: Call webhook from Private Packagist to create the PR
shell: bash
run: "curl -fsSL -X POST -u ${{ github.event.client_payload.webhook.authentication.username }}:${{ github.event.client_payload.webhook.authentication.password }} --header \"Content-Type: application/json\" --data '{\"runId\":\"${{github.run_id}}\",\"ciScriptVersion\":\"0.1\"}' ${{ github.event.client_payload.webhook.executedUrl }}"
- name: Call webhook from Private Packagist to notify about build failure
shell: bash
if: ${{ failure() }}
run: "curl -fsSL -X POST -u ${{ github.event.client_payload.webhook.authentication.username }}:${{ github.event.client_payload.webhook.authentication.password }} --header \"Content-Type: application/json\" --data '{\"runId\":\"${{github.run_id}}\",\"ciScriptVersion\":\"0.1\"}' ${{ github.event.client_payload.webhook.errorUrl }}"