-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: Rewrite container address retrieval as a composite action.
- Loading branch information
1 parent
557b8fe
commit f41548a
Showing
2 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: ip-address | ||
description: > | ||
Grabs the IP address of a given container. | ||
inputs: | ||
|
||
container: | ||
required: true | ||
|
||
outputs: | ||
|
||
address: | ||
description: > | ||
The input container's IP address. | ||
value: ${{ steps.fetch.outputs.address }} | ||
|
||
runs: | ||
|
||
using: composite | ||
|
||
steps: | ||
|
||
- name: Retrieve container IP address | ||
|
||
id: fetch | ||
|
||
env: | ||
NAME_OR_ID: ${{ inputs.container }} | ||
|
||
shell: bash | ||
|
||
run: | | ||
CONTAINER_IP_ADDRESS="$(docker container inspect --format '{{ range.NetworkSettings.Networks }}{{ .IPAddress }}{{ end }}' "${NAME_OR_ID}")" | ||
echo "address=${CONTAINER_IP_ADDRESS}" >> "$GITHUB_OUTPUT" | ||
test -n "${CONTAINER_IP_ADDRESS}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters