Add create-pr tool to container image
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Tom Neuber 2024-10-09 13:33:05 +02:00
parent 9847dbf0bf
commit 901bc94e2e
Signed by: tom
GPG key ID: F17EFE4272D89FF6
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,5 @@
FROM johnwalkerx/gitea-pull-request-create-plugin:latest AS gprcp
FROM alpine:latest
RUN apk add --no-cache bash yq
@ -7,6 +9,8 @@ COPY messages.yaml /messages.yaml
RUN chmod +x /entrypoint.sh
ENV OUTPUT_FILE="message.txt"
COPY --from=gprcp /gitea-pull-request-create-plugin /gitea-pull-request-create-plugin
RUN chmod +x /gitea-pull-request-create-plugin
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -1,7 +1,6 @@
#!/bin/bash
MESSAGE_FILE="/messages.yaml"
OUTPUT_FILE=${OUTPUT_FILE:-"message.txt"}
NUM_MESSAGES=$(yq eval '.messages | length' "$MESSAGE_FILE")
@ -9,6 +8,8 @@ RANDOM_INDEX=$(( RANDOM % NUM_MESSAGES ))
MESSAGE=$(yq eval ".messages[$RANDOM_INDEX]" "$MESSAGE_FILE")
echo "$MESSAGE" > "$OUTPUT_FILE"
PLUGIN_PR_BODY=$(echo "$PLUGIN_PR_BODY" | sed "s|{- random-pr-message -}|$MESSAGE|")
echo "Selected message written to $OUTPUT_FILE"
echo "$PLUGIN_PR_BODY"
/gitea-pull-request-create-plugin