-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaction.yml
93 lines (93 loc) · 3.47 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 'Maven-Lockfile'
description: 'This action generates a lockfile for a Maven project.'
branding:
icon: 'lock'
color: 'blue'
inputs:
github-token:
description: 'GitHub token'
required: true
commit-lockfile:
description: 'Commit the lockfile to the repository in case the pom.xml or workflow file has updated. If this is false or the pom.xml and workflow.yml files are unchanged the action will verify the current lockfile.json.'
required: false
default: 'true'
commit-message:
description: 'Commit message for the lockfile'
required: false
default: 'chore: update lockfile'
commit-author:
description: |
'
Author for the lockfile commit. GitHub provides three values for this field.
- github_actor -> UserName <[email protected]>
- user_info -> Your Display Name <[email protected]>
- github_actions -> github-actions <email associated with the github logo
'
required: false
default: 'github_actions'
include-maven-plugins:
description: 'Include Maven plugins in the lockfile'
required: false
default: 'false'
lockfile-name:
description: 'Name of the lockfile (default="lockfile.json")'
required: false
default: 'lockfile.json'
workflow-filename:
description: 'Name of the workflow file'
required: false
default: 'Lockfile.yml'
runs:
using: "composite"
steps:
- name: checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
token: ${{ inputs.github-token }}
- name: Setup Java
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
with:
maven-version: 3.8.2
- id: install-jbang
run: curl -Ls https://sh.jbang.dev | bash -s - app setup
shell: bash
- name: Get all changed pom.xml and lockfile.json file(s)
id: changed-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45
with:
files: |
**/pom.xml
**/${{ inputs.workflow-filename}}
- name: print all changed files
run: echo all changed files are ${{ steps.changed-files.outputs.all_changed_files }}
shell: bash
- name: Set POM_CHANGED environment variable
run: echo "POM_CHANGED=${{ steps.changed-files.outputs.any_changed}}" >> $GITHUB_ENV
shell: bash
- name: print POM-CHANGED
run: echo "pom changed ${{ env.POM_CHANGED }}"
shell: bash
- name: Set COMMIT_UPDATED_LOCKFILE environment variable
run: echo "COMMIT_UPDATED_LOCKFILE=${{ inputs.commit-lockfile }}" >> $GITHUB_ENV
shell: bash
- id: action
run: ~/.jbang/bin/jbang --repos 'mavencentral' io.github.chains-project:maven-lockfile-github-action:5.3.6-SNAPSHOT
shell: bash
env:
JSON_INPUTS: ${{ toJSON(inputs) }}
GITHUB_TOKEN: ${{ inputs.github-token }}
- id: commit-lockfile
if: inputs.commit-lockfile == 'true'
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
default_author: ${{ inputs.commit-author }}
message: ${{ inputs.commit-message }}