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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ out
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.idea/
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

---
## [Unreleased](https://github.com/ryancyq/github-signed-commit/tree/HEAD)
## [1.3.0](https://github.com/ryancyq/github-signed-commit/compare/v1.2.0..v1.3.0) - 2024-10-30

### Features

- Add support for remote GitHub repository + working directory ([#2](https://github.com/ryancyq/github-signed-commit/issues/2)) - ([2c19408](https://github.com/ryancyq/github-signed-commit/commit/2c19408618f096a6064093809288c28e3f4daaa1)) - Xavier Krantz

### Tests

Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ jobs:
tag: v1.0.3
```

```yaml
jobs:
<job-id>:
permissions:
contents: write # grant secrets.GITHUB_TOKEN permission to push file changes

- name: Create empty commit
uses: ryancyq/github-signed-commit@v1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit-message: Trigger rebuild
allow-empty: true
```

Note: The `GH_TOKEN` environment variable is **required** for GitHub API request authentication.

## Inputs
Expand All @@ -63,10 +78,11 @@ Note: The `GH_TOKEN` environment variable is **required** for GitHub API request
| `files` | **YES** | Multi-line string of file paths to be committed, relative to the current workspace.|
| `workspace` | **NO** | Directory containing files to be committed. **DEFAULT:** GitHub workspace directory (root of the repository). |
| `commit-message` | **YES** | Commit message for the file changes. |
| `branch-name` | **NO** | Branch to commit, it must already exist in the remote. **DEFAULT:** Workflow triggered branch |
| `branch-name` | **NO*** | Branch to commit, it must already exist in the remote. **DEFAULT:** Workflow triggered branch. **REQUIRED:** If triggered through `on tags`.|
| `branch-push-force` | **NO** | `--force` flag when running `git push <branch-name>`. |
| `tag` | **NO** | Push tag for the new/current commit. |
| `tag-only-if-file-changes` | **NO** | Push tag for new commit only when file changes present. **DEFAULT:** true |
| `allow-empty` | **NO** | Allow creating commits even when no file changes are detected. **DEFAULT:** false |

## Outputs
| Output | Description |
Expand All @@ -79,4 +95,4 @@ Note: The `GH_TOKEN` environment variable is **required** for GitHub API request
[coverage_badge]: https://codecov.io/gh/ryancyq/github-signed-commit/graph/badge.svg?token=KZTD2F2MN2
[coverage]: https://codecov.io/gh/ryancyq/github-signed-commit
[maintainability_badge]: https://api.codeclimate.com/v1/badges/0de9dbec270ca85719c6/maintainability
[maintainability]: https://codeclimate.com/github/ryancyq/github-signed-commit/maintainability
[maintainability]: https://codeclimate.com/github/ryancyq/github-signed-commit/maintainability
4 changes: 2 additions & 2 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('Git CLI', () => {

describe('git add', () => {
beforeEach(() => {
jest.spyOn(cwd, 'getWorkspace').mockReturnValue('/test-workspace')
jest.spyOn(cwd, 'getWorkspace').mockReturnValue('test-workspace/')
})

it('should ensure file paths are within curent working directory', async () => {
Expand All @@ -190,7 +190,7 @@ describe('Git CLI', () => {
await addFileChanges(['*.ts', '~/.bashrc'])
expect(execMock).toHaveBeenCalledWith(
'git',
['add', '--', '/test-workspace/*.ts', '/test-workspace/~/.bashrc'],
['add', '--', 'test-workspace/*.ts', 'test-workspace/~/.bashrc'],
expect.objectContaining({
listeners: { stdline: expect.anything(), errline: expect.anything() },
})
Expand Down
18 changes: 18 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ inputs:
Directory containing files to be committed. Default: GitHub workspace directory (root of repository).
required: false
default: ''
workdir:
description: |
Directory where the action should run. Default: GitHub workspace directory (root of repository from where the GH Workflow is triggered).
required: false
default: ''
commit-message:
description: |
Commit message for the file changes.
required: false
owner:
description: |
GitHub repository owner (user or organization), defaults to the repo invoking the action.
required: false
repo:
description: |
GitHub repository name, defaults to the repo invoking the action.
required: false
branch-name:
description: |
Branch to commit to. Default: Workflow triggered branch.
Expand All @@ -39,6 +52,11 @@ inputs:
Push tag for new commit only when file changes present.
required: false
default: true
allow-empty:
description: |
Allow creating commits even when no file changes are detected.
required: false
default: false

outputs:
commit-sha:
Expand Down
Loading
Loading