-
Notifications
You must be signed in to change notification settings - Fork 180
Add automated blog image workflow #2010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
685e344
75eae84
c63aa51
23e68ee
337e6f1
68b861c
6c291c8
15e1926
3373911
6fd6c95
8e51176
d16c7e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Blog Image Workflow Configuration | ||
| # Copy this file to .blog-config.sh and fill in your API keys | ||
|
|
||
| # OpenAI API key for DALL-E image generation | ||
| # Get your key from: https://platform.openai.com/api-keys | ||
| OPENAI_API_KEY="sk-your-api-key-here" | ||
|
|
||
| # TinyPNG API key for image optimization (optional) | ||
| # Get your key from: https://tinypng.com/developers | ||
| # If not provided, will use ImageMagick for local optimization | ||
| TINYPNG_API_KEY="" | ||
|
|
||
| # Path to your images repository | ||
| # This should point to the local clone of github.com/haacked/images | ||
| IMAGES_REPO_PATH="$HOME/dev/haacked/images" | ||
|
|
||
| # Base URL for published images | ||
| IMAGE_BASE_URL="https://i.haacked.com" | ||
|
|
||
| # Optional: Editor command to open new posts | ||
| # Examples: "code", "vim", "subl", etc. | ||
| # Leave empty to skip auto-opening | ||
| EDITOR="" | ||
|
|
||
| # DALL-E image generation settings | ||
| DALLE_MODEL="dall-e-3" | ||
| DALLE_SIZE="1024x1024" # Options: 1024x1024, 1792x1024, 1024x1792 | ||
| DALLE_QUALITY="standard" # Options: standard, hd | ||
| DALLE_STYLE="vivid" # Options: vivid, natural | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||
| name: Test Blog Scripts | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: ["main"] | ||||||
| pull_request: | ||||||
| branches: ["main"] | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
||||||
| jobs: | ||||||
| test: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Install BATS | ||||||
| run: | | ||||||
| sudo apt-get update | ||||||
| sudo apt-get install -y bats | ||||||
|
||||||
| sudo apt-get install -y bats | |
| sudo apt-get install -y bats-core |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| # Run all tests for blog workflow scripts | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Get script directory | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" | ||
|
|
||
| # Colors | ||
| GREEN='\033[0;32m' | ||
| RED='\033[0;31m' | ||
| YELLOW='\033[1;33m' | ||
| NC='\033[0m' | ||
|
|
||
| echo -e "${GREEN}Running blog workflow tests...${NC}\n" | ||
|
|
||
| # Check if bats is installed | ||
| if ! command -v bats > /dev/null 2>&1; then | ||
| echo -e "${RED}Error: bats is not installed${NC}" | ||
| echo "Install with: brew install bats-core" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Run unit tests | ||
| echo -e "${YELLOW}=== Unit Tests ===${NC}" | ||
| if bats "$ROOT_DIR/tests/unit/"*.bats; then | ||
| echo -e "\n${GREEN}✓ All unit tests passed!${NC}\n" | ||
| else | ||
| echo -e "\n${RED}✗ Some unit tests failed${NC}\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Run integration tests if they exist | ||
| if [ -d "$ROOT_DIR/tests/integration" ] && [ -n "$(ls -A "$ROOT_DIR/tests/integration"/*.bats 2> /dev/null)" ]; then | ||
| echo -e "${YELLOW}=== Integration Tests ===${NC}" | ||
| if bats "$ROOT_DIR/tests/integration/"*.bats; then | ||
| echo -e "\n${GREEN}✓ All integration tests passed!${NC}\n" | ||
| else | ||
| echo -e "\n${RED}✗ Some integration tests failed${NC}\n" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo -e "${GREEN}========================================${NC}" | ||
| echo -e "${GREEN}All tests passed! ✓${NC}" | ||
| echo -e "${GREEN}========================================${NC}" |
Uh oh!
There was an error while loading. Please reload this page.