Skip to content

Commit 6e9bf00

Browse files
committed
chore(actions): add minimal composite GitHub Action and README usage
1 parent 9d67753 commit 6e9bf00

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

README.MD

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,27 @@ $ npx codemod <transform> --target <path> [...options]
2121
See the [codemod CLI doc](https://go.codemod.com/cli-docs) for a full list of available commands.
2222

2323
All codemods are also available in the [Codemod Registry](https://go.codemod.com/registry).
24+
25+
## GitHub Action
26+
27+
Use the composite action in this repository to run the Codemod CLI in GitHub Actions:
28+
29+
```yaml
30+
name: Codemod
31+
on:
32+
workflow_dispatch:
33+
jobs:
34+
run-codemod:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Run codemod (dry run)
39+
uses: codemod-com/commons@v0
40+
with:
41+
args: "@codemod-com/your-codemod --dry-run"
42+
```
43+
44+
Notes:
45+
- `inputs.args` is passed to `npx codemod` and defaults to `--version`.
46+
- The Action wraps `npx -y codemod`; no install needed.
47+
- To publish on Marketplace, create a tagged release (e.g., `v0.0.1`) and select "Publish this Action to Marketplace" when drafting the release.

action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Codemod CLI"
2+
description: "Run the Codemod CLI in GitHub Actions via npx."
3+
author: "Codemod"
4+
branding:
5+
icon: "code"
6+
color: "purple"
7+
8+
inputs:
9+
args:
10+
description: "Arguments to pass to the Codemod CLI (e.g. '@codemod-com/some-codemod --dry-run'). Defaults to '--version'."
11+
required: false
12+
default: "--version"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Run Codemod
18+
shell: bash
19+
run: |
20+
set -euo pipefail
21+
npx -y codemod ${{ inputs.args }}
22+
23+

0 commit comments

Comments
 (0)