-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaction.yaml
65 lines (63 loc) · 2.27 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
name: "Bazel steward"
description: "Automatically searches bazel repositories for dependencies and updates them"
author: ""
inputs:
configuration-path:
description: "The path to bazel steward configuration"
default: "./bazel-steward.yaml"
github-token:
description: "A token for the Github repository"
default: ${{ github.token }}
github-personal-token:
description: "A personal token for triggering the workflows by closing and reopening pull requests"
required: false
use-release:
description: "Whether to use prebuild jar from release, instead of compiling code"
default: "true"
push-to-remote:
description: "Whether to push changes to remote and open pull requests"
default: "true"
additional-args:
description: "Additional arguments to bazel steward jar"
required: false
runs:
using: "composite"
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
distribution: 'temurin'
java-version: 11
- name: Download release
if: ${{ inputs.use-release == 'true' }}
run: |
TAG_PATTERN=$(echo "${{ github.action_path }}" | grep -Po "(?<=\/)[^\/]*$")
if [[ $TAG_PATTERN == v* ]] ;
then
TAG_NAME=$(gh release list -L 100 --repo $REPOSITORY | grep -Eo '^'"$TAG_PATTERN"'[\.0-9]*' | sort -Vr | head -n 1)
else
TAG_NAME=$TAG_PATTERN
fi
gh release download $TAG_NAME --pattern bazel-steward.jar --repo $REPOSITORY
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: VirtusLab/bazel-steward
shell: bash
- name: Build jar file
if: ${{ inputs.use-release != 'true' }}
uses: ./.github
- name: Setup git user
uses: fregante/setup-git-user@v1
- name: Run bazel steward
run: |
NO_REMOTE=$([[ $PUSH_TO_REMOTE == 'true' ]] && echo "" || echo "--no-remote")
java -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO -jar bazel-steward.jar \
--github $NO_REMOTE --config-path '${{ inputs.configuration-path }}' ${{ inputs.additional-args }}
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
PERSONAL_TOKEN: ${{ inputs.github-personal-token }}
PUSH_TO_REMOTE: ${{ inputs.push-to-remote }}
branding:
icon: 'umbrella'
color: 'green'