Skip to content

Commit c2b460c

Browse files
committed
Use local actions paths
1 parent c451950 commit c2b460c

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

build-gradle/action.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,25 @@ outputs:
8787
runs:
8888
using: composite
8989
steps:
90-
- name: Set local action
90+
- name: Set local action paths
91+
id: set-path
9192
shell: bash
9293
run: |
94+
echo "::group::Fix for using local actions"
95+
echo "GITHUB_ACTION_PATH=$GITHUB_ACTION_PATH"
96+
echo "github.action_path=${{ github.action_path }}"
97+
ACTION_PATH_BUILD_GRADLE="${{ github.action_path }}"
98+
echo "ACTION_PATH_BUILD_GRADLE=$ACTION_PATH_BUILD_GRADLE"
99+
echo "ACTION_PATH_BUILD_GRADLE=$ACTION_PATH_BUILD_GRADLE" >> "$GITHUB_ENV"
100+
host_actions_root="$(dirname "$ACTION_PATH_BUILD_GRADLE")"
101+
echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT"
102+
93103
mkdir -p ".actions"
94-
ln -s "${{github.action_path}}/../config-gradle" .actions/config-gradle
95-
ln -s "${{github.action_path}}/../shared" .actions/shared
104+
ln -sf "$host_actions_root/config-gradle" .actions/config-gradle
105+
ln -sf "$host_actions_root/shared" .actions/shared
106+
ls -la .actions/*
107+
echo "::endgroup::"
108+
96109
- name: Set build parameters
97110
shell: bash
98111
env:
@@ -136,6 +149,7 @@ runs:
136149
uses: ./.actions/config-gradle
137150
id: config-gradle
138151
with:
152+
host-actions-root: ${{ steps.set-path.outputs.host_actions_root }}
139153
artifactory-reader-role: ${{ inputs.artifactory-reader-role }}
140154
use-develocity: ${{ inputs.use-develocity }}
141155
develocity-url: ${{ inputs.develocity-url }}

config-gradle/action.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ inputs:
2626
disable-caching:
2727
description: Whether to disable Gradle caching entirely
2828
default: 'false'
29+
host-actions-root:
30+
description: Path to the actions folder on the host (used when called from another local action)
31+
default: ''
2932

3033
outputs:
3134
BUILD_NUMBER:
@@ -35,9 +38,35 @@ outputs:
3538
runs:
3639
using: composite
3740
steps:
41+
- name: Set local action paths
42+
id: set-path
43+
shell: bash
44+
run: |
45+
echo "::group::Fix for using local actions"
46+
echo "GITHUB_ACTION_PATH=$GITHUB_ACTION_PATH"
47+
echo "github.action_path=${{ github.action_path }}"
48+
ACTION_PATH_CONFIG_GRADLE="${{ github.action_path }}"
49+
host_actions_root="${{ inputs.host-actions-root }}"
50+
if [ -z "$host_actions_root" ]; then
51+
host_actions_root="$(dirname "$ACTION_PATH_CONFIG_GRADLE")"
52+
else
53+
ACTION_PATH_CONFIG_GRADLE="$host_actions_root/config-gradle"
54+
fi
55+
echo "ACTION_PATH_CONFIG_GRADLE=$ACTION_PATH_CONFIG_GRADLE"
56+
echo "ACTION_PATH_CONFIG_GRADLE=$ACTION_PATH_CONFIG_GRADLE" >> "$GITHUB_ENV"
57+
echo "host_actions_root=$host_actions_root" >> "$GITHUB_OUTPUT"
58+
59+
mkdir -p ".actions"
60+
ln -sf "$host_actions_root/get-build-number" .actions/get-build-number
61+
ln -sf "$host_actions_root/shared" .actions/shared
62+
ls -la .actions/*
63+
echo "::endgroup::"
64+
3865
- name: Get build number
3966
id: get_build_number
40-
uses: SonarSource/ci-github-actions/get-build-number@v1
67+
uses: ./.actions/get-build-number
68+
with:
69+
host-actions-root: ${{ steps.set-path.outputs.host_actions_root }}
4170

4271
- name: Set parameter for Vault
4372
shell: bash

0 commit comments

Comments
 (0)