-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: onboard git-commit-metadata composite action
- Loading branch information
Showing
5 changed files
with
128 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Git Commit Metadata Action | ||
|
||
A GitHub Action to retrieve the metadata associated with the given git commit. | ||
|
||
## Inputs | ||
|
||
```yaml | ||
inputs: | ||
repository: | ||
required: true | ||
type: string | ||
ref: | ||
required: true | ||
type: string | ||
fetch-depth: | ||
required: false | ||
type: string | ||
default: 0 | ||
``` | ||
## Outputs | ||
```yaml | ||
outputs: | ||
git_sha_long: ${{ steps.metadata.outputs.git_sha_long }} | ||
git_sha_short: ${{ steps.metadata.outputs.git_sha_short }} | ||
git_commit_msg: ${{ steps.metadata.outputs.git_commit_msg }} | ||
``` | ||
## Example workflow | ||
```yml | ||
steps: | ||
``` | ||
## License | ||
All composite actions and unit tests in this project are released under the [MIT License](../../LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# _ _ | ||
# __ _____ _ __| |_ _____ _| |__ _____ __ | ||
# \ \ / / _ \ '__| __/ _ \ \/ / '_ \ / _ \ \/ / | ||
# \ V / __/ | | || __/> <| |_) | (_) > < | ||
# \_/ \___|_| \__\___/_/\_\_.__/ \___/_/\_\ | ||
# | ||
# | ||
# Copyright (C) 2023-2024 @vertexbox <https://github.com/vertexbox> | ||
# | ||
# This is a open-source software, licensed under the MIT License. | ||
# See /License for more information. | ||
|
||
name: Get git commit metadata | ||
description: "get the metadata associated to a specific git commit" | ||
|
||
inputs: | ||
repository: | ||
required: true | ||
type: string | ||
ref: | ||
required: true | ||
type: string | ||
fetch-depth: | ||
required: false | ||
type: string | ||
default: 0 | ||
|
||
outputs: | ||
git_sha_long: ${{ steps.metadata.outputs.git_sha_long }} | ||
git_sha_short: ${{ steps.metadata.outputs.git_sha_short }} | ||
git_commit_msg: ${{ steps.metadata.outputs.git_commit_msg }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Get metadata associated to the given ref | ||
id: metadata | ||
run: | | ||
echo "git_sha_long=${{ inputs.ref }}" >> $GITHUB_OUTPUT | ||
echo "git_sha_short=$(echo ${{ inputs.ref }} | cut -c1-6)" >> $GITHUB_OUTPUT | ||
echo "git_commit_msg=$(git log --format=%s -n 1 ${{ inputs.ref }})" >> $GITHUB_OUTPUT | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# _ _ | ||
# __ _____ _ __| |_ _____ _| |__ _____ __ | ||
# \ \ / / _ \ '__| __/ _ \ \/ / '_ \ / _ \ \/ / | ||
# \ V / __/ | | || __/> <| |_) | (_) > < | ||
# \_/ \___|_| \__\___/_/\_\_.__/ \___/_/\_\ | ||
# | ||
# | ||
# Copyright (C) 2023-2024 @vertexbox <https://github.com/vertexbox> | ||
# | ||
# This is a open-source software, licensed under the MIT License. | ||
# See /License for more information. | ||
|
||
name: git-revision-count unit test | ||
description: Test git-revision-count composite action | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: git-commit-metadata | ||
id: metadata | ||
uses: vertexbox/github-seed-actions/git/git-commit-metadata@master | ||
with: | ||
repository: ${{ github.repository }} | ||
# ref: ${{ github.event.pull_request.head.sha }} # pr | ||
ref: ${{ github.sha }} # default_branch (master|main|develop) | ||
|
||
- name: git-revision-count | ||
run: | | ||
echo ${{ steps.metadata.outputs.git_sha_long }} | ||
echo ${{ steps.metadata.outputs.git_sha_short }} | ||
echo ${{ steps.metadata.outputs.git_commit_msg }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters