-
-
Notifications
You must be signed in to change notification settings - Fork 12
fix: Handle already-linked app in re-deploy scenarios #224
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
base: master
Are you sure you want to change the base?
Changes from all commits
75209f1
8440afc
7995483
9736fea
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 |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
| 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: | ||
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
There was a problem hiding this comment.
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.