Skip to content

Commit

Permalink
Merge pull request #144 from smlx/read-only
Browse files Browse the repository at this point in the history
feat: add the option for the action to be read-only
  • Loading branch information
smlx authored May 24, 2024
2 parents 6623a0b + f554ab9 commit 1df9a73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 9 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Conventional Commits Versioner Action
description: Automatically tag a new version based on the commit messages of commits since the last tag.
inputs:
write-tag:
description: 'If true, and ccv determines that a new version is required, the action will automatically write the new version tag to the repository.'
required: false
default: 'true'
outputs:
new_tag:
new-tag:
description: Either "true" or "false" depending on whether a new tag was pushed.
new_tag_version:
new-tag-version:
description: The new version that was tagged. This will only be set if new_tag=true.
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.write-tag }}
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh
set -eu
# if the first argument to the script is "true", it will push a tag to the repository.
WRITE_TAG="$1"
# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action#accessing-files-created-by-a-container-action
cd /github/workspace
# if the ccv tag exists, just exit
Expand All @@ -8,7 +10,9 @@ if [ "$(git tag -l "$(ccv)")" ]; then
exit
fi
# if it doesn't, tag and push
git tag "$(ccv)"
git push --tags
if [ "$WRITE_TAG" = "true" ]; then
git tag "$(ccv)"
git push --tags
fi
echo "new_tag=true" >>"$GITHUB_OUTPUT"
echo "new_tag_version=$(git tag --points-at HEAD)" >>"$GITHUB_OUTPUT"
echo "new_tag_version=$(ccv)" >>"$GITHUB_OUTPUT"

0 comments on commit 1df9a73

Please sign in to comment.