mirror of
https://github.com/LukeSmithxyz/based.cooking.git
synced 2025-12-23 02:49:52 +00:00
move to hugo
This commit is contained in:
12
.github/pull_request_template.md
vendored
12
.github/pull_request_template.md
vendored
@@ -1,12 +0,0 @@
|
||||
<!--
|
||||
- Recipes should be `.md` files in the `src/` directory. Look at already
|
||||
existing `.md` files for examples or see [example](example.md).
|
||||
- File names should be the name of the dish with words separated by hyphens
|
||||
(`-`). Not underscores, and definitely not spaces.
|
||||
- Recipe must be based, i.e. good traditional and substantial food. Nothing
|
||||
ironic, meme-tier hyper-sugary, meat-substitute, etc.
|
||||
- Be sure to add a small number of relevant tags to your recipe (and remove
|
||||
the dummy tags). Try to use already existing tags.
|
||||
- Don't include salt and pepper and other ubiquitous things in the ingredients
|
||||
list.
|
||||
-->
|
||||
12
.github/workflows/pr.yaml
vendored
12
.github/workflows/pr.yaml
vendored
@@ -1,12 +0,0 @@
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
check_files:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Check files for compliance
|
||||
run: .github/workflows/scripts/check-files.sh
|
||||
|
||||
153
.github/workflows/scripts/check-files.sh
vendored
153
.github/workflows/scripts/check-files.sh
vendored
@@ -1,153 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
SIZE_LIMIT=150000
|
||||
FAIL=0
|
||||
|
||||
check_size() {
|
||||
size="$(stat --printf="%s" "$1")"
|
||||
if [ "$size" -gt "$SIZE_LIMIT" ]; then
|
||||
echo "File $1 is bigger than specified $SIZE_LIMIT limit"
|
||||
FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_file_name() {
|
||||
fileName="$1"
|
||||
expectedFolder="$2"
|
||||
|
||||
shouldname="${expectedFolder}/$(basename "$fileName" |
|
||||
iconv --to-code=utf-8 |
|
||||
tr '[:upper:]' '[:lower:]' |
|
||||
tr '_ ' '-')"
|
||||
|
||||
if [ "$shouldname" != "$fileName" ]; then
|
||||
echo "$1 should be named $shouldname."
|
||||
FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
check_webp_name() {
|
||||
check_file_name "$1" "data/pix"
|
||||
}
|
||||
|
||||
check_recipe_name() {
|
||||
check_file_name "$1" "src"
|
||||
}
|
||||
|
||||
check_recipe_content() {
|
||||
errMsgs="$(awk '
|
||||
BEGIN {
|
||||
HAS_TITLE = 0;
|
||||
HAS_TAGS = 0;
|
||||
HAS_INVALID_TAGS = 0;
|
||||
NUM_TAGS = 0;
|
||||
HAS_INGREDIENTS = 0;
|
||||
HAS_DIRECTIONS = 0;
|
||||
HAS_CONSECUTIVE_EMPTY_LINES = 0;
|
||||
|
||||
CONSECUTIVE_EMPTY_LINES = 0;
|
||||
}
|
||||
|
||||
# First line should be the title
|
||||
NR == 1 && /^# / {
|
||||
HAS_TITLE = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
$0 == "## Ingredients" {
|
||||
HAS_INGREDIENTS = 1;
|
||||
}
|
||||
|
||||
$0 == "## Directions" {
|
||||
HAS_DIRECTIONS = 1;
|
||||
}
|
||||
|
||||
$0 == "" {
|
||||
CONSECUTIVE_EMPTY_LINES++
|
||||
if (CONSECUTIVE_EMPTY_LINES >= 2) {
|
||||
HAS_CONSECUTIVE_EMPTY_LINES = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$0 != "" {
|
||||
CONSECUTIVE_EMPTY_LINES = 0;
|
||||
}
|
||||
|
||||
END {
|
||||
# Last line should be the tags list
|
||||
if ($1 == ";tags:") {
|
||||
HAS_TAGS = 1;
|
||||
NUM_TAGS = NF - 1;
|
||||
|
||||
# Loop through all the tags
|
||||
for (i = 2; i <= NF; i++) {
|
||||
# Make sure that each tag only contains lowercase letters and hyphens
|
||||
if ($i !~ "^[a-z-]+$") {
|
||||
HAS_INVALID_TAGS = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!HAS_TITLE) {
|
||||
print "Recipe does not have a properly formatted title on the first line."
|
||||
}
|
||||
|
||||
if (!HAS_TAGS) {
|
||||
print "Recipe does not have a properly formatted tags on the last line."
|
||||
} else {
|
||||
if (HAS_INVALID_TAGS) {
|
||||
print "Recipe has invalid tags. Tags must be separated by spaces and contain only lowercase letters or hyphens (-)";
|
||||
}
|
||||
|
||||
if (NUM_TAGS < 2) {
|
||||
print "Recipe only has " NUM_TAGS " tags. Add some more."
|
||||
} else if (NUM_TAGS > 5) {
|
||||
print "Recipe has " NUM_TAGS " tags which is too many. Remove some tags."
|
||||
}
|
||||
}
|
||||
|
||||
if (!HAS_INGREDIENTS) {
|
||||
print "Recipe does not have an ingredients list."
|
||||
}
|
||||
|
||||
if (!HAS_DIRECTIONS) {
|
||||
print "Recipe does not have a directions section."
|
||||
}
|
||||
|
||||
if (HAS_CONSECUTIVE_EMPTY_LINES) {
|
||||
print "Recipe has at least 2 consecutive empty lines.";
|
||||
}
|
||||
}
|
||||
' "$1")"
|
||||
|
||||
if [ -n "$errMsgs" ]; then
|
||||
echo "$errMsgs"
|
||||
FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
while IFS= read -r file; do
|
||||
echo "Checking '$file'"
|
||||
case "$file" in
|
||||
# Ignore these files
|
||||
index.md) ;;
|
||||
.github/*.md) ;;
|
||||
|
||||
*.webp)
|
||||
check_size "$file"
|
||||
check_webp_name "$file"
|
||||
;;
|
||||
*.md)
|
||||
check_recipe_name "$file"
|
||||
check_recipe_content "$file"
|
||||
;;
|
||||
esac
|
||||
# Separate each file for easier reading.
|
||||
echo ""
|
||||
done <<EOF
|
||||
$(git diff --name-only "$(git merge-base origin/master HEAD)")
|
||||
EOF
|
||||
|
||||
exit $FAIL
|
||||
33
.github/workflows/upload.yml
vendored
33
.github/workflows/upload.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: CI
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Triggers the workflow on push to master (including merged PRs)
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
update:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
- name: Updating website.
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: based.cooking
|
||||
username: based
|
||||
key: ${{ secrets.based_ssh }}
|
||||
passphrase: ${{ secrets.based_ssh_pass }}
|
||||
port: ${{ secrets.based_port }}
|
||||
script: |
|
||||
cd repo
|
||||
git stash
|
||||
git pull --force origin master
|
||||
make deploy
|
||||
Reference in New Issue
Block a user