Skip to content

Commit 113f95f

Browse files
test: cover custom commit identity in action-commit-push
1 parent 7f06330 commit 113f95f

2 files changed

Lines changed: 61 additions & 10 deletions

File tree

.github/workflows/e2e-action-commit-push.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,57 @@ jobs:
296296
git push origin --delete "${branch}"
297297
fi
298298
299+
commit-with-custom-identity:
300+
name: Commit with custom user_name and user_email
301+
needs: [preflight]
302+
runs-on: ubuntu-latest
303+
steps:
304+
- name: Checkout repository
305+
uses: actions/checkout@v6
306+
with:
307+
fetch-depth: 0
308+
309+
- name: Create test file
310+
run: echo "E2E identity override test $(date -u)" > e2e-identity-override.md
311+
312+
- name: Commit with custom identity
313+
if: ${{ inputs.mode == 'ref' }}
314+
id: commit
315+
uses: devops-infra/action-commit-push@master
316+
with:
317+
github_token: ${{ secrets.GITHUB_TOKEN }}
318+
commit_message: "test(commit-push): custom identity test"
319+
target_branch: test/e2e-commit-push-identity-${{ github.run_id }}
320+
user_name: "Release Automation"
321+
user_email: "release-bot@example.com"
322+
323+
- name: Commit via docker image (preview)
324+
if: ${{ inputs.mode == 'image' }}
325+
run: |
326+
if [ -z "${{ inputs.image_tag }}" ]; then
327+
echo "image_tag is required when mode=image"
328+
exit 1
329+
fi
330+
echo "Image mode placeholder for devopsinfra/action-commit-push:${{ inputs.image_tag }}"
331+
echo "Use ref mode for authoritative validation until image-mode harness is finalized."
332+
333+
- name: Verify commit identity
334+
if: ${{ inputs.mode == 'ref' }}
335+
run: |
336+
git fetch origin "test/e2e-commit-push-identity-${{ github.run_id }}"
337+
test "$(git log -1 --format=%an "origin/test/e2e-commit-push-identity-${{ github.run_id }}")" = "Release Automation"
338+
test "$(git log -1 --format=%ae "origin/test/e2e-commit-push-identity-${{ github.run_id }}")" = "release-bot@example.com"
339+
test "$(git log -1 --format=%cn "origin/test/e2e-commit-push-identity-${{ github.run_id }}")" = "Release Automation"
340+
test "$(git log -1 --format=%ce "origin/test/e2e-commit-push-identity-${{ github.run_id }}")" = "release-bot@example.com"
341+
342+
- name: Cleanup - delete test branch
343+
if: ${{ always() && inputs.mode == 'ref' }}
344+
run: |
345+
branch="test/e2e-commit-push-identity-${{ github.run_id }}"
346+
if git ls-remote --exit-code --heads origin "${branch}" >/dev/null 2>&1; then
347+
git push origin --delete "${branch}"
348+
fi
349+
299350
reset-target-branch-to-base:
300351
name: Reset target branch to base branch
301352
needs: [preflight]

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ In Slavic mythology, Triglav represents three realms. That maps well to this fra
2222

2323
## Covered Actions and Test Types
2424

25-
| Action | Workflow | Test Coverage |
26-
|------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
27-
| `devops-infra/action-commit-push` | `.github/workflows/e2e-action-commit-push.yml` | branch creation/push, custom message/prefix, empty commit mode, amend with force-with-lease, GPG and SSH signed commits, output verification, cleanup |
28-
| `devops-infra/action-pull-request` | `.github/workflows/e2e-action-pull-request.yml` | PR creation/update paths, custom title/body, draft + `get_diff`, `repository` + `repository_path`, output verification, cleanup |
29-
| `devops-infra/action-format-hcl` | `.github/workflows/e2e-action-format-hcl.yml` | check mode pass/fail, write mode, list/diff mode, malformed input detection |
30-
| `devops-infra/action-container-structure-test` | `.github/workflows/e2e-action-container-structure-test.yml` | text/json/junit output modes, report file creation, multi-config execution, output counters |
31-
| `devops-infra/action-terraform-copy-vars` | `.github/workflows/e2e-action-terraform-copy-vars.yml` | variable propagation across modules, custom path inputs, strict missing-variable failure mode |
32-
| `devops-infra/action-terraform-validate` | `.github/workflows/e2e-action-terraform-validate.yml` | valid module validation, scoped validation via `dir_filter` |
33-
| `devops-infra/action-tflint` | `.github/workflows/e2e-action-tflint.yml` | lint execution across modules, scoped lint via `dir_filter`, non-blocking findings mode |
34-
| `devops-infra/template-action` | `.github/workflows/e2e-action-template-action.yml` | baseline template behavior validation, output contract checks, debug-mode execution |
25+
| Action | Workflow | Test Coverage |
26+
|------------------------------------------------|-------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
27+
| `devops-infra/action-commit-push` | `.github/workflows/e2e-action-commit-push.yml` | branch creation/push, custom message/prefix, custom commit name/email, empty commit mode, amend with force-with-lease, GPG and SSH signed commits, output verification, cleanup |
28+
| `devops-infra/action-pull-request` | `.github/workflows/e2e-action-pull-request.yml` | PR creation/update paths, custom title/body, draft + `get_diff`, `repository` + `repository_path`, output verification, cleanup |
29+
| `devops-infra/action-format-hcl` | `.github/workflows/e2e-action-format-hcl.yml` | check mode pass/fail, write mode, list/diff mode, malformed input detection |
30+
| `devops-infra/action-container-structure-test` | `.github/workflows/e2e-action-container-structure-test.yml` | text/json/junit output modes, report file creation, multi-config execution, output counters |
31+
| `devops-infra/action-terraform-copy-vars` | `.github/workflows/e2e-action-terraform-copy-vars.yml` | variable propagation across modules, custom path inputs, strict missing-variable failure mode |
32+
| `devops-infra/action-terraform-validate` | `.github/workflows/e2e-action-terraform-validate.yml` | valid module validation, scoped validation via `dir_filter` |
33+
| `devops-infra/action-tflint` | `.github/workflows/e2e-action-tflint.yml` | lint execution across modules, scoped lint via `dir_filter`, non-blocking findings mode |
34+
| `devops-infra/template-action` | `.github/workflows/e2e-action-template-action.yml` | baseline template behavior validation, output contract checks, debug-mode execution |
3535

3636
## Workflow Orchestration
3737

0 commit comments

Comments
 (0)