-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaction.yml
84 lines (81 loc) · 2.86 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
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'
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 <UserName@users.noreply.github.com>
- user_info -> Your Display Name <your-actual@email.com>
- 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'
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: 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@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45
with:
files: |
**/pom.xml
**/lockfile.json
**/${{ 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
- id: action
run: ~/.jbang/bin/jbang --repos 'mavencentral' io.github.chains-project:maven-lockfile-github-action:5.2.4-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 }}