-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathaction.yaml
More file actions
81 lines (79 loc) · 2.81 KB
/
action.yaml
File metadata and controls
81 lines (79 loc) · 2.81 KB
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
name: "Bazel Steward"
description: "Automatically searches bazel repositories for dependencies and updates them"
author: ""
inputs:
configuration-path:
description: "The path to bazel steward configuration"
required: false
default: ""
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@v4
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
echo $TAG_NAME
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: Move obtained bazel-steward.jar
run: mv ./bazel-steward.jar /tmp/bazel-steward.jar
shell: bash
- name: Check if git user is set
id: check_git_user
run: |
if git config user.name; then
echo "user_exists=true" >> $GITHUB_ENV
else
echo "user_exists=false" >> $GITHUB_ENV
fi
shell: bash
- name: Setup git user if missing
if: env.user_exists == 'false'
uses: fregante/setup-git-user@v2
- name: Run bazel steward
run: |
NO_REMOTE=$([[ $PUSH_TO_REMOTE == 'true' ]] && echo "" || echo "--no-remote")
CONFIG_PATH_ARG=$([[ -n "${{ inputs.configuration-path }}" ]] && echo "--config-path ${{ inputs.configuration-path }}" || echo "")
java -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO -jar /tmp/bazel-steward.jar \
--github $NO_REMOTE $CONFIG_PATH_ARG ${{ 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'