38 Commits
v1.0 ... main

Author SHA1 Message Date
6f22c61866 Merge pull request #8 from noah-software/dev
Added execution rights to entrypoint script
2023-01-02 17:21:43 +01:00
841bc4e805 Added execution rights to entrypoint script 2023-01-02 17:12:27 +01:00
a0783b9f4a Merge pull request #6 from noah-software/dev
Updated documentation + Adjusted default commit_message
2022-09-21 14:57:35 +02:00
cb16418b18 Merge branch 'main' into dev 2022-09-21 14:57:29 +02:00
c045cd21a1 Added git output path 2022-07-11 14:20:12 +02:00
a9d1874c6d Readded first part of git setup 2022-07-11 14:16:56 +02:00
9961990618 Removed git setup 2022-07-11 14:11:40 +02:00
cdbf90b6cb Changed variables to bash style 2022-07-11 14:05:59 +02:00
3532070f31 Changed to bash shell 2022-07-11 13:46:36 +02:00
2794f9277d Adjusted git check 2022-07-11 13:41:14 +02:00
24f2748d1e Tried adjusting git status 2022-07-11 13:38:45 +02:00
645d8b7d48 Readded x for the script actions 2022-07-11 13:33:30 +02:00
c1371a0f89 Removed pydot dependencies 2022-07-11 13:29:46 +02:00
562d275999 Added graphviz as dependency 2022-07-11 13:24:05 +02:00
f765dad8a2 Removed non existing dependencies 2022-07-11 13:16:50 +02:00
2e97cfb798 Updated docs 2022-07-11 13:14:48 +02:00
a94ac16063 Build container from a different image 2022-07-11 11:43:26 +02:00
d095959190 Removed dependencies for now 2021-02-14 13:16:54 +01:00
3453c9394d Removed cargo from dependencies 2021-02-14 12:43:37 +01:00
1c2cef08ae Added wheel to default installs 2021-02-14 00:59:46 +01:00
f5ffd2f04c Default installing pydot 2021-02-14 00:58:38 +01:00
89fbc0403b Bumped alpine version 2021-02-10 19:44:31 +01:00
5c2949e038 Upgrading pip before the action runs 2021-02-10 18:49:48 +01:00
b52a452408 Merged parameters on git commit 2020-11-06 09:41:03 +01:00
da6e513b3a Added build dependencies 2020-10-29 15:55:58 +01:00
3e4e529a21 Added necessary dependency 2020-10-29 15:47:03 +01:00
1310f15c3d New try removing the python dependencies 2020-10-29 15:01:55 +01:00
70db1bdc39 Update Dockerfile 2020-10-20 11:17:52 +02:00
690136f592 Update Dockerfile 2020-10-20 11:09:41 +02:00
72b0e8297d Fixed bug with the python name 2020-10-20 11:04:50 +02:00
33e6c5c073 Update Dockerfile 2020-10-20 11:03:13 +02:00
a5cc4e5468 Update Dockerfile 2020-10-20 11:00:54 +02:00
ba78d9c707 Update Dockerfile 2020-10-20 10:58:18 +02:00
1660ca00d2 Update Dockerfile 2020-10-20 10:55:48 +02:00
88bd3eb649 Debugging using ubuntu 2020-10-20 10:53:37 +02:00
a701ca41c5 Moved to windowservercore 2020-10-20 10:49:17 +02:00
68af7a3b20 Moved to python image 2020-10-20 10:42:53 +02:00
ecc49a0807 Updated documentation + Adjusted default commit_message 2020-10-06 17:04:33 +02:00
5 changed files with 26 additions and 38 deletions

View File

@@ -1,7 +1,6 @@
FROM alpine:3.12
RUN apk update && apk add --no-cache bash git openssh python3 py3-pip graphviz gcc
RUN python3 -m pip install --upgrade pip setuptools wheel pyparsing pydot django-extensions django
FROM python:3.10-slim-bullseye
RUN apt-get update -y && apt-get install -y --no-install-recommends bash git graphviz graphviz-dev musl-dev build-essential gcc && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 noah UG
Copyright (c) 2020 noah GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -6,12 +6,14 @@ A GitHub action for drawing a Django data model automatically.
### Parameters
| Parameter | Required | Default | Description |
| -------------- | :------: | :---------------: | ---------------------------------------- |
| commit_message | :x: | Added data schema | Custom git commit message |
| output_path | :x: | . | Output path for generated files |
| pip_path | :x: | requirements.txt | Requirements path for the Django project |
| project_path | :x: | ./ | The path to manage.py |
| Parameter | Required | Default | Description |
| -------------- | :------: | :-----------------: | ------------------------------------------------------------------ |
| commit_message | :x: | Updated data schema | Custom git commit message |
| output_path | :x: | . | Output path for generated files (see 'Example Config' for example) |
| pip_path | :x: | requirements.txt | Requirements path for the Django project |
| project_path | :x: | ./ | The path to manage.py (see 'Example Config' for example) |
> Note: The output_path has to exist already.
### Example Config
@@ -26,7 +28,7 @@ on:
- master
jobs:
prettier:
graph-models:
runs-on: ubuntu-latest
steps:
@@ -37,7 +39,7 @@ jobs:
ref: ${{ github.head_ref }}
- name: Generate Data Schema
uses: noah-software/django_action@v1.0
uses: noah-software/django_action@v1.1
with:
# This part is also where you can pass other options, for example:
pip_path: testfolder/app/requirements.txt

View File

@@ -7,7 +7,7 @@ inputs:
commit_message:
description: Commit message of the changed data
required: false
default: "Added data schema"
default: "Updated data schema"
pip_path:
description: Path relative to the repository root, where the requirements.txt is located
required: false

View File

@@ -1,44 +1,31 @@
#!/bin/sh
#!/bin/bash
# e is for exiting the script automatically if a command fails, u is for exiting if a variable is not set
# x would be for showing the commands before they are executed
set -eu
set -eux
# FUNCTIONS
# Function for setting up git env in the docker container (copied from https://github.com/stefanzweifel/git-auto-commit-action/blob/master/entrypoint.sh)
_git_setup ( ) {
cat <<- EOF > $HOME/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 $HOME/.netrc
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"
}
# Checks if any files are changed
_git_changed() {
[[ -n "$(git status -s)" ]]
}
# PROGRAM
echo "Installing dependencies..."
pip3 install --no-cache-dir -r $INPUT_PIP_PATH
pip3 install -U pip wheel pygraphviz
pip3 install --no-cache-dir -r "$INPUT_PIP_PATH"
echo "Creating data model..."
cd $INPUT_PROJECT_PATH
python3 manage.py graph_models -a -g -o $INPUT_OUTPUT_PATH
cd "$INPUT_PROJECT_PATH"
python3 manage.py graph_models -a -g -o "$INPUT_OUTPUT_PATH"
# To keep runtime good, just continue if something was changed
if _git_changed;
then
if [[ `git status --porcelain` ]]; then
# Calling method to configure the git environemnt
_git_setup
# Commit and push changes back
git commit -a -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
git add "$INPUT_OUTPUT_PATH"
git commit -am "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com>"
git push origin
echo "Changes pushed successfully."
else