Created
July 28, 2022 10:43
-
-
Save muvaf/783c97aa2ba6fbdf4a6248e24d661afb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export COMMENT='olala omama /test-examples="provider-aws/examples/acm/*.yaml,provider-aws/examples/ec2/*.yaml"' | |
export PROVIDER_NAME=$(echo $COMMENT | sed 's/^.*\/test-examples="//g' | cut -d '/' -f 1) | |
echo "Provider: ${PROVIDER_NAME}" | |
# Create an array from the test statement. This expands the * signs as well. | |
PATHS=$(echo $COMMENT | sed 's/^.*\/test-examples="//g' | cut -d '"' -f 1 | sed 's/,/ /g') | |
EXAMPLE_LIST="" | |
for PATH in $PATHS | |
do | |
EXAMPLE_LIST="${EXAMPLE_LIST},${PATH}" | |
done | |
# Remove the first character. | |
echo "Examples: ${EXAMPLE_LIST:1}" | |
# Provider: provider-aws | |
# Examples: provider-aws/examples/acm/certificate-dns.yaml,provider-aws/examples/acm/certificate-email.yaml,provider-aws/examples/acm/certificatevalidation-dns.yaml,provider-aws/examples/acm/certificatevalidation-email.yaml,provider-aws/examples/ec2/instance.yaml,provider-aws/examples/ec2/internetgateway.yaml,provider-aws/examples/ec2/launchtemplate.yaml,provider-aws/examples/ec2/natgateway.yaml,provider-aws/examples/ec2/networkinterface.yaml,provider-aws/examples/ec2/route.yaml,provider-aws/examples/ec2/routetable.yaml,provider-aws/examples/ec2/securitygroup.yaml,provider-aws/examples/ec2/securitygrouprule.yaml,provider-aws/examples/ec2/subnet.yaml,provider-aws/examples/ec2/vpc.yaml,provider-aws/examples/ec2/vpcipv4cidrblockassociation.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment