generated from AndreasAugustin/template
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
119 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.github/ | ||
.devcontainer/ | ||
.dependabot/ |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
|
||
test-implementation-job: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# To use this repository's private action, you must check out the repository | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Test action step | ||
uses: ./ # Uses an action in the root directory | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
source_repo_path: AndreasAugustin/template.git |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: 'Template sync' | ||
description: 'Synchronises changes of the template repository' | ||
author: 'AndreasAugustin' | ||
branding: | ||
icon: cloud | ||
color: green | ||
inputs: | ||
github_token: | ||
description: 'Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }}' | ||
required: true | ||
source_repo_path: | ||
description: 'Repository path of the template' | ||
required: true | ||
runs: | ||
using: 'docker' | ||
image: 'src/Dockerfile' | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.github_token }} | ||
SOURCE_REPO_PATH: ${{ inputs.source_repo_path }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ services: | |
target: DEV | ||
volumes: | ||
- .:/app/ | ||
- ~/.gitconfig:/root/.gitconfig:ro | ||
docs: | ||
build: | ||
context: . | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM golang:1.14-alpine | ||
# labels | ||
LABEL \ | ||
"name"="GitHub template sync" \ | ||
"homepage"="https://github.com/marketplace/actions/github-template-sync" \ | ||
"repository"="https://github.com/AndreasAugustin/actions-template-sync" \ | ||
"maintainer"="Andreas Augustin <[email protected]>" | ||
|
||
# install packages | ||
RUN apk add --update --no-cache bash make git zsh curl tmux musl build-base | ||
|
||
RUN git clone https://github.com/cli/cli.git gh-cli \ | ||
&& cd gh-cli \ | ||
&& make \ | ||
&& mv ./bin/gh /usr/local/bin/ | ||
|
||
ADD *.sh /bin/ | ||
RUN chmod +x /bin/entrypoint.sh \ | ||
&& chmod +x /bin/sync_template.sh | ||
|
||
ENTRYPOINT ["/bin/entrypoint.sh"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
[ -z "${GITHUB_TOKEN}" ] && { | ||
echo "Missing input 'github_token: \${{ secrets.GITHUB_TOKEN }}'."; | ||
exit 1; | ||
}; | ||
|
||
if [[ -z "${SOURCE_REPO_PATH}" ]]; then | ||
echo "Missing input 'source_repo_path: \${{ input.source_repo_path }}'.;" | ||
exit 1 | ||
fi | ||
|
||
SOURCE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${SOURCE_REPO_PATH}" | ||
|
||
echo "set git global configuration" | ||
git config --global user.email "[email protected]@" | ||
git config --global user.name "actions-template-sync" | ||
|
||
source sync_template.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
if [[ -z "${SOURCE_REPO}" ]]; then | ||
echo "Error: Missing env variable 'SOURCE_REPO'" >&2; | ||
exit 1; | ||
fi | ||
|
||
if ! [ -x "$(command -v gh)" ]; then | ||
echo "Error: github-cli gh is not installed. 'https://github.com/cli/cli'" >&2; | ||
exit 1; | ||
fi | ||
|
||
NEW_BRANCH="chore/template_sync" | ||
|
||
echo "start sync" | ||
echo "create new branch from default branch with name ${NEW_BRANCH}" | ||
git checkout -b ${NEW_BRANCH} | ||
echo "pull changes from template" | ||
git pull "${SOURCE_REPO}" --allow-unrelated-histories | ||
git add . | ||
git commit -m "chore(template): merge template changes :up:" | ||
echo "push changes" | ||
git push --set-upstream origin "${NEW_BRANCH}" | ||
echo "create pull request" | ||
gh pr create -b master -f -l chore |