Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
id: docker-labels-tags
run: |
echo 'labels<<__LABELS_EOF__' >> $GITHUB_OUTPUT
echo "org.opencontainers.image.title=47ng/actions-clever-cloud" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.title=beyond-scale-group/actions-clever-cloud" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.description=GitHub action to deploy to Clever Cloud" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.version=${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.revision=${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
Expand All @@ -130,13 +130,13 @@ jobs:
echo '__LABELS_EOF__' >> $GITHUB_OUTPUT
echo 'tags<<__TAGS_EOF__' >> $GITHUB_OUTPUT
if [ "${{ github.ref_name }}" == "master" ]; then
echo "ghcr.io/47ng/actions-clever-cloud:${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
echo "47ng/actions-clever-cloud:${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
echo "ghcr.io/beyond-scale-group/actions-clever-cloud:${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
echo "beyond-scale-group/actions-clever-cloud:${{ steps.package.outputs.version }}" >> $GITHUB_OUTPUT
fi
echo "ghcr.io/47ng/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "ghcr.io/47ng/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
echo "47ng/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "47ng/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
echo "ghcr.io/beyond-scale-group/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "ghcr.io/beyond-scale-group/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: If you want to use your own image registry, feel free to fork this repository, but I can't merge this as-is.

echo "beyond-scale-group/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "beyond-scale-group/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
echo '__TAGS_EOF__' >> $GITHUB_OUTPUT

- name: Set up QEMU
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
id: docker-labels-tags
run: |
echo 'labels<<__LABELS_EOF__' >> $GITHUB_OUTPUT
echo "org.opencontainers.image.title=47ng/actions-clever-cloud" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.title=beyond-scale-group/actions-clever-cloud" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.description=GitHub action to deploy to Clever Cloud (PR preview)" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.version=${{ steps.package.outputs.version }}-pr.${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "org.opencontainers.image.revision=${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
Expand All @@ -125,8 +125,8 @@ jobs:
echo "org.opencontainers.image.url=https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" >> $GITHUB_OUTPUT
echo '__LABELS_EOF__' >> $GITHUB_OUTPUT
echo 'tags<<__TAGS_EOF__' >> $GITHUB_OUTPUT
echo "ghcr.io/47ng/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "ghcr.io/47ng/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
echo "ghcr.io/beyond-scale-group/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}" >> $GITHUB_OUTPUT
echo "ghcr.io/beyond-scale-group/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
Comment on lines +128 to +129
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: If you want to use your own image registry, feel free to fork this repository, but I can't merge this as-is.

echo '__TAGS_EOF__' >> $GITHUB_OUTPUT

- name: Set up QEMU
Expand Down Expand Up @@ -178,10 +178,10 @@ jobs:

\`\`\`yaml
# Use the PR number to follow changes in this PR
- uses: docker://ghcr.io/47ng/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}
- uses: docker://ghcr.io/beyond-scale-group/actions-clever-cloud:${{ steps.docker-tag.outputs.tag }}

# Use the git SHA for pinning to a specific commit
- uses: docker://ghcr.io/47ng/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}
- uses: docker://ghcr.io/beyond-scale-group/actions-clever-cloud:git-${{ steps.sha.outputs.sha }}
Comment on lines +181 to +184
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: If you want to use your own image registry, feel free to fork this repository, but I can't merge this as-is.

\`\`\`

<details>
Expand Down
42 changes: 42 additions & 0 deletions CLAUDE.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Rename this file to AGENTS.md for cross-agent configuration (hopefully one day Claude Code can align to the rest of the ecosystem, but I'm more in favour of OSS harnesses who follow a similar convention).

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## What This Is

A GitHub Action that deploys applications to Clever Cloud via the Clever Cloud CLI. It runs as a Docker container (`ghcr.io/47ng/actions-clever-cloud`). The action authenticates with Clever Cloud, optionally links an app, sets environment variables, then runs `clever deploy`.

## Commands

```bash
pnpm test # Run tests with Vitest (includes type checking)
pnpm build # Bundle src/main.ts → dist/main.js via tsdown
pnpm knip # Dead code detection
```

There is no lint script in package.json. ESLint is configured but run ad-hoc.

To run a single test file: `pnpm vitest run src/action.test.ts`
To run a single test by name: `pnpm vitest run -t "test name pattern"`

## Architecture

**Entry flow**: `src/main.ts` → `processArguments()` → `run(args)`

- `src/main.ts` — Entry point. Fixes git dubious ownership, parses args, calls `run()`.
- `src/arguments.ts` — Reads GitHub Action inputs via `@actions/core` and env vars (`CLEVER_TOKEN`, `CLEVER_SECRET`). Returns a typed `Arguments` object.
- `src/action.ts` — Core logic: checks for shallow clone, authenticates CLI, links app (with unlink-first for idempotency), sets env vars, deploys with optional timeout via `Promise.race()`.

**Build**: tsdown bundles to `dist/main.js`. Multi-stage Dockerfile compiles in builder, copies dist + production node_modules to final image based on `node:24.9.0-slim`.

**Docker image versioning**: The version in `action.yml` (`image: docker://ghcr.io/47ng/actions-clever-cloud:X.Y.Z`) must match `package.json` version. CI checks this.

## Code Style

- ES Modules (`"type": "module"`) with `import.meta.main` guard
- No semicolons, single quotes, no trailing commas, 2-space indent
- Strict TypeScript with `noUncheckedIndexedAccess`

## Testing Patterns

Tests mock `@actions/exec` and `@actions/core` using `vi.mock()` at the top level. The `exec` mock captures calls so tests can assert on CLI arguments and call order. Tests use `vi.resetModules()` + dynamic `import()` in `beforeEach` to get fresh module state.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Clever Cloud
name: BSG Deploy to Clever Cloud
description: Deploy your application to Clever Cloud
author: François Best
branding:
Expand Down Expand Up @@ -56,4 +56,4 @@ inputs:
If not set, the Clever Cloud CLI default (error) will be used.
runs:
using: docker
image: docker://ghcr.io/47ng/actions-clever-cloud:2.1.0
image: docker://ghcr.io/beyond-scale-group/actions-clever-cloud:2.2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: If you want to use your own image registry, feel free to fork this repository, but I can't merge this as-is.

Loading