Skip to content

Commit

Permalink
Update action to the current spec
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimush committed Mar 8, 2020
1 parent fd41511 commit 12fa033
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 42 deletions.
34 changes: 7 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
FROM debian:buster-slim
FROM alpine/git:latest

RUN apt-get update && \
apt-get install -y curl gnupg2 jq && \
rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache bash curl jq

ENV HUB_VERSION=2.12.8
RUN mkdir /tmp/hub && \
(curl -SL https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz | tar --strip 1 -zxC /tmp/hub) && \
prefix=/usr /tmp/hub/install && \
rm -rf /tmp/hub
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing hub

ENV TENPURETO_VERSION=0.4.0
RUN echo "deb https://dl.bintray.com/tenpureto/deb-snapshots buster main" >> /etc/apt/sources.list && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61 && \
apt-get update && \
apt-get install -y tenpureto=${TENPURETO_VERSION}-buster && \
rm -rf /var/lib/apt/lists/*
ENV TENPURETO_VERSION=0.5.0
RUN curl -sL https://github.com/tenpureto/tenpureto/releases/download/v${TENPURETO_VERSION}/tenpureto-${TENPURETO_VERSION}-x86_64-linux -o /usr/bin/tenpureto && \
chmod +x /usr/bin/tenpureto

ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
Expand All @@ -27,19 +18,8 @@ ENV [email protected]
ENV GIT_COMMITTER_NAME=Tenpureto
ENV [email protected]

LABEL "com.github.actions.name"="Tenpureto"
LABEL "com.github.actions.description"="Tenpureto templates automation"
LABEL "com.github.actions.icon"="git-merge"
LABEL "com.github.actions.color"="blue"

LABEL "repository"="https://github.com/tenpureto/tenpureto-github-action"
LABEL "homepage"="http://tenpureto.org"
LABEL "maintainer"="Roman Timushev <[email protected]>"

ENV PULL_REQUEST_LABEL=""
ENV PULL_REQUEST_LABEL ""

ADD *.sh /usr/local/bin/

ENV GIT_ASKPASS="/usr/local/bin/askpass.sh"

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Tenpureto
description: Propagate template changes to child branches
inputs:
pull-request-label:
description: Labels to assign to the created pull requests
required: false
runs:
using: "docker"
image: "Dockerfile"
env:
PULL_REQUEST_LABEL: ${{ inputs.pull-request-label }}
branding:
icon: git-merge
color: blue
3 changes: 0 additions & 3 deletions askpass.sh

This file was deleted.

21 changes: 9 additions & 12 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

set -euo pipefail

case "$1" in
propagate)
ARGS=(--template "https://github.com/${GITHUB_REPOSITORY}.git" --branch "${GITHUB_REF#refs/heads/}" --pull-request --unattended)
if [[ ! -z "${PULL_REQUEST_LABEL}" ]]; then
ARGS+=(--pull-request-label "${PULL_REQUEST_LABEL}")
fi
if [[ "$(hub api "/users/${GITHUB_ACTOR}" | jq -r .type)" = "User" ]]; then
ARGS+=(--pull-request-assignee "${GITHUB_ACTOR}")
fi
echo Running tenpureto template propagate-changes "${ARGS[@]}"
tenpureto template propagate-changes "${ARGS[@]}"
esac
ARGS=(--template "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" --branch "${GITHUB_REF#refs/heads/}" --pull-request --unattended)
if [[ ! -z "${PULL_REQUEST_LABEL}" ]]; then
ARGS+=(--pull-request-label "${PULL_REQUEST_LABEL}")
fi
if [[ "$(hub api "/users/${GITHUB_ACTOR}" | jq -r .type)" = "User" ]]; then
ARGS+=(--pull-request-assignee "${GITHUB_ACTOR}")
fi
echo Running tenpureto template propagate-changes "${ARGS[@]}"
tenpureto template propagate-changes "${ARGS[@]}"

0 comments on commit 12fa033

Please sign in to comment.