Skip to content

Commit cf84eee

Browse files
Added tagging
1 parent f308953 commit cf84eee

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ The commit message to be used in the output repository. Optional and defaults to
3535

3636
The string `ORIGIN_COMMIT` is replaced by `$REPOSITORY_URL@commit`.
3737

38+
### `commit-tag` (argument) [optional]
39+
Tags a commit.
40+
3841
### `API_TOKEN_GITHUB` (environment)
3942
E.g.:
4043
`API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}`

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: '[Optional] commit message for the output repository. ORIGIN_COMMIT is replaced by the URL@commit in the origin repo'
2626
default: 'Update from ORIGIN_COMMIT'
2727
required: false
28+
commit-tag:
29+
description: '[Optional] Tag a commit'
30+
default: 'None'
31+
required: false
2832
runs:
2933
using: 'docker'
3034
image: 'Dockerfile'
@@ -36,6 +40,7 @@ runs:
3640
- ${{ inputs.destination-repository-username }}
3741
- ${{ inputs.target-branch }}
3842
- ${{ inputs.commit-message }}
43+
- ${{ inputs.commit-tag }}
3944
branding:
4045
icon: 'git-commit'
4146
color: 'green'

entrypoint.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ USER_EMAIL="$4"
1111
DESTINATION_REPOSITORY_USERNAME="$5"
1212
TARGET_BRANCH="$6"
1313
COMMIT_MESSAGE="$7"
14+
COMMIT_TAG="$8"
1415

1516
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
1617
then
@@ -48,5 +49,13 @@ git status
4849
git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE"
4950

5051
echo "Pushing git commit"
51-
# --set-upstream: sets de branch when pushing to a branch that does not exist
52+
# --set-upstream: sets the branch when pushing to a branch that does not exist
5253
git push origin --set-upstream "$TARGET_BRANCH"
54+
55+
# tag the commit
56+
if [ -z "$COMMIT_TAG" ]
57+
then
58+
echo "Tagging the commit"
59+
git tag "$COMMIT_TAG"
60+
git push origin --tags
61+
fi

0 commit comments

Comments
 (0)