Added many, many more actions.
This commit is contained in:
16
yq/yq/Dockerfile
Normal file
16
yq/yq/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
# Container image that runs your code
|
||||
FROM debian:stable-slim
|
||||
|
||||
RUN apt update && apt install -y \
|
||||
wget
|
||||
|
||||
ARG VERSION=v4.30.6
|
||||
ARG BINARY=yq_linux_amd64
|
||||
|
||||
RUN wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq && \
|
||||
chmod +x /usr/bin/yq
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
24
yq/yq/action.yaml
Normal file
24
yq/yq/action.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: yq
|
||||
description: "Run yq commands."
|
||||
inputs:
|
||||
command:
|
||||
description: "Shell arguments to pass into yq."
|
||||
required: true
|
||||
program:
|
||||
description: "Program to run instead of yq. Default: yq"
|
||||
required: false
|
||||
default: "yq"
|
||||
catchErrors:
|
||||
description: "Whether or not errors should be handled."
|
||||
required: false
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the command."
|
||||
runs:
|
||||
env:
|
||||
PROGRAM: ${{ inputs.program }}
|
||||
CATCH_ERRORS: ${{ inputs.catchErrors }}
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ${{ inputs.command }}
|
||||
27
yq/yq/entrypoint.sh
Normal file
27
yq/yq/entrypoint.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
COMMAND="$@"
|
||||
|
||||
# yq -p json -o yaml file.json # json -> yaml
|
||||
# yq -p json -o xml file.json # json -> xml
|
||||
# yq -p yaml -o json file.yaml # yaml -> json
|
||||
# yq -p yaml -o xml file.yaml # yaml -> xml
|
||||
# yq -p xml -o json file.xml # xml -> json
|
||||
# yq -p xml -o yaml file.xml # xml -> yaml
|
||||
#https://github.com/mikefarah/yq
|
||||
PROGRAM=${PROGRAM:-"yq"}
|
||||
OUTPUT=$(bash -c "$PROGRAM $COMMAND")
|
||||
RESULT=$?
|
||||
|
||||
#Output multiline strings.
|
||||
#https://trstringer.com/github-actions-multiline-strings/
|
||||
if [[ -n "$OUTPUT" ]]; then
|
||||
echo "console<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [[ "$CATCH_ERRORS" != "true" ]]; then
|
||||
exit $RESULT
|
||||
fi
|
||||
Reference in New Issue
Block a user