|
4 | 4 | input: |
5 | 5 | description: 'The branch, tag, SHA or custom name to build a tag for' |
6 | 6 | required: true |
| 7 | + repository: |
| 8 | + description: 'The source repository (e.g., ethereum/go-ethereum)' |
| 9 | + required: false |
| 10 | + upstream_repository: |
| 11 | + description: 'The upstream repository to compare against (e.g., ethereum/go-ethereum)' |
| 12 | + required: false |
7 | 13 | outputs: |
8 | 14 | docker_tag: |
9 | 15 | description: "The docker tag to use" |
|
21 | 27 | exit 1 |
22 | 28 | fi |
23 | 29 |
|
| 30 | + # Check if repository is provided and is not the upstream repo |
| 31 | + repository="${{ inputs.repository }}" |
| 32 | + upstream_repo="${{ inputs.upstream_repository }}" |
| 33 | + prefix="" |
| 34 | + |
| 35 | + # If upstream_repo is not provided, we don't add any prefix |
| 36 | + # This maintains backward compatibility |
| 37 | + if [ -n "$upstream_repo" ] && [ -n "$repository" ]; then |
| 38 | + # If repository is provided and is not the upstream, extract author and prefix |
| 39 | + if [ "$repository" != "$upstream_repo" ]; then |
| 40 | + # Extract the author part (everything before the /) |
| 41 | + author="$(echo "$repository" | cut -d'/' -f1)" |
| 42 | + if [ -n "$author" ]; then |
| 43 | + prefix="${author}-" |
| 44 | + echo "Non-upstream repository detected: $repository (upstream: $upstream_repo)" |
| 45 | + echo "Adding prefix: $prefix" |
| 46 | + fi |
| 47 | + fi |
| 48 | + fi |
| 49 | +
|
24 | 50 | # replace all special characters to - (allowed: -_.) |
25 | 51 | # fix/bug#123 -> fix-bug-123 |
26 | 52 | # pr@123 -> pr-123 |
|
31 | 57 | # -fix -> fix |
32 | 58 | docker_tag="$(echo "$docker_tag" | sed 's/^-*//')" |
33 | 59 |
|
| 60 | + # Add prefix if we have one |
| 61 | + docker_tag="${prefix}${docker_tag}" |
34 | 62 |
|
35 | 63 | echo "docker_tag=$docker_tag" >> $GITHUB_OUTPUT |
36 | 64 | echo "Docker Tag: $docker_tag" |
0 commit comments