Add create-pr tool to container image
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
9847dbf0bf
commit
901bc94e2e
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
FROM johnwalkerx/gitea-pull-request-create-plugin:latest AS gprcp
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN apk add --no-cache bash yq
|
RUN apk add --no-cache bash yq
|
||||||
|
@ -7,6 +9,8 @@ COPY messages.yaml /messages.yaml
|
||||||
|
|
||||||
RUN chmod +x /entrypoint.sh
|
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"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MESSAGE_FILE="/messages.yaml"
|
MESSAGE_FILE="/messages.yaml"
|
||||||
OUTPUT_FILE=${OUTPUT_FILE:-"message.txt"}
|
|
||||||
|
|
||||||
NUM_MESSAGES=$(yq eval '.messages | length' "$MESSAGE_FILE")
|
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")
|
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
|
||||||
|
|
Loading…
Reference in a new issue