name: "Ghost GitHub Portfolio" description: "Auto-sync GitHub repositories to a Ghost CMS portfolio page" author: "GeiserX" branding: icon: "layout" color: "purple" inputs: config-path: description: "Path to the config YAML file" required: false default: "config.yml" ghost-url: description: "Ghost blog URL (overrides config)" required: false ghost-admin-api-key: description: "Ghost Admin API key in KEY_ID:SECRET format" required: false ghost-page-slug: description: "Ghost page slug to update" required: false github-username: description: "GitHub username to fetch repos for" required: false min-stars: description: "Minimum stars to include a repo" required: false default: "" runs: using: "composite" steps: - name: Setup Node.js uses: actions/setup-node@v7 with: node-version: "22" - name: Install and build shell: bash working-directory: ${{ github.action_path }} run: | npm ci npm run build - name: Generate config overrides shell: bash id: config working-directory: ${{ github.action_path }} env: GGP_CONFIG: ${{ github.workspace }}/${{ inputs.config-path }} GGP_GHOST_URL: ${{ inputs.ghost-url }} GGP_GHOST_PAGE_SLUG: ${{ inputs.ghost-page-slug }} GGP_GITHUB_USERNAME: ${{ inputs.github-username }} GGP_MIN_STARS: ${{ inputs.min-stars }} run: | CONFIG="$GGP_CONFIG" if [ -n "$GGP_GHOST_URL" ] || [ -n "$GGP_GHOST_PAGE_SLUG" ] || [ -n "$GGP_GITHUB_USERNAME" ] || [ -n "$GGP_MIN_STARS" ]; then cp "$CONFIG" /tmp/ggp-config.yml CONFIG=/tmp/ggp-config.yml node -e ' const fs = require("fs"); const yaml = require("yaml"); const c = yaml.parse(fs.readFileSync(process.env.GGP_CONFIG, "utf8")) || {}; if (process.env.GGP_GHOST_URL) { c.ghost = c.ghost || {}; c.ghost.url = process.env.GGP_GHOST_URL; } if (process.env.GGP_GHOST_PAGE_SLUG) { c.ghost = c.ghost || {}; c.ghost.pageSlug = process.env.GGP_GHOST_PAGE_SLUG; } if (process.env.GGP_GITHUB_USERNAME) { c.github = c.github || {}; c.github.username = process.env.GGP_GITHUB_USERNAME; } if (process.env.GGP_MIN_STARS) { const n = Number.parseInt(process.env.GGP_MIN_STARS, 10); if (!Number.isFinite(n)) throw new Error("min-stars must be an integer"); c.portfolio = c.portfolio || {}; c.portfolio.minStars = n; } fs.writeFileSync("/tmp/ggp-config.yml", yaml.stringify(c)); ' fi echo "config=$CONFIG" >> "$GITHUB_OUTPUT" - name: Sync portfolio shell: bash env: GHOST_ADMIN_API_KEY: ${{ inputs.ghost-admin-api-key }} GHOST_GITHUB_TOKEN: ${{ github.token }} run: | node ${{ github.action_path }}/dist/index.js sync \ --config "${{ steps.config.outputs.config }}" \ --verbose