Skip to content

Commit

Permalink
Merge pull request #17 from r7kamura/command
Browse files Browse the repository at this point in the history
Run command in deno
  • Loading branch information
r7kamura authored May 30, 2024
2 parents 9152c82 + fab57d4 commit bc9b16b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: r7kamura/bump-request@v0
with:
command: |
npm version --no-git-commit-hooks --no-git-tag-version "${{ inputs.version }}"
npm version --no-git-commit-hooks --no-git-tag-version "$VERSION"
version: ${{ inputs.version }}
```
Expand Down Expand Up @@ -56,22 +56,22 @@ This action simply creates a pull request and does nothing more. If you want to

### `command`

Shell command for modifying files that contain versions such as package.json, Catgo.toml, etc.
Shell command for modifying files that contain versions such as package.json, Catgo.toml, etc. `VERSION` environment variable is available in the command.

- required

NPM package example:

```yaml
command: |
npm version --no-git-commit-hooks --no-git-tag-version "${{ inputs.version }}"
npm version --no-git-commit-hooks --no-git-tag-version "$VERSION"
```
Ruby gem example:
```yaml
command: |
sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/${{ inputs.version }}/' lib/my_ruby_gem/version.rb
sed -i -r "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/" lib/my_ruby_gem/version.rb
bundle install
```
Expand Down
5 changes: 1 addition & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ runs:
using: composite
steps:
- uses: actions/checkout@v3
- name: Run command
run: |
${{ inputs.command }}
shell: bash
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno run --allow-all src/main.ts
env:
BUMP_REQUEST_INPUTS_COMMAND: ${{ inputs.command }}
BUMP_REQUEST_INPUTS_VERSION: ${{ inputs.version }}
GITHUB_TOKEN: ${{ inputs.github_token || github.token }}
shell: bash
Expand Down
12 changes: 12 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { exec } from "./deps.ts";
import { github } from "./deps.ts";
import { createAndPushCommit } from "./git.ts";
import { createPullRequest, generateNotes } from "./github.ts";

const githubToken = Deno.env.get("GITHUB_TOKEN")!;
const command = Deno.env.get("BUMP_REQUEST_INPUTS_COMMAND")!;
const version = Deno.env.get("BUMP_REQUEST_INPUTS_VERSION")!;
const branch = `bump-request-${github.context.runId}`;
const title = `Change version to ${version}`;

await exec.exec(
command,
[],
{
env: {
VERSION: version,
},
},
);

const response = await generateNotes({
githubToken: githubToken,
owner: github.context.repo.owner,
Expand Down

0 comments on commit bc9b16b

Please sign in to comment.