Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overwrite and ref targets. Adds more functionality / flexibility to action #14

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/**
7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ It would be more useful to use this with other GitHub Actions' outputs.

## Inputs

| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| --------- | -------------------------- | -------- | -------- | ------- |
| `tag` | A Git tag name. | `string` | `true` | `N/A` |
| `message` | A message for the Git tag. | `string` | `false` | `''` |
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
| ------------ | -------------------------------------- | -------- | -------- | ------- |
| `tag` | A Git tag name. | `string` | `true` | `N/A` |
| `message` | A message for the Git tag. | `string` | `false` | `''` |
| `ref` | Commit SHA or tag to target. | `string` | `false` | `''` |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be nice to update example in the README.MD with an real case where you use all the new parameters.
For example: it's not clear if the force parameter is analog of git force or it's something else. And why would I need a ref

| `force` | A message for the Git tag. | `boolean`| `false` | `false` |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix description

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix desciption of the force paramater

| `always-pass`| If step should pass if tag push fails | `boolean`| `false` | `false` |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always-pass sounds weird. ignore-failures maybe? Or always-succeed?


## Example

Expand All @@ -34,13 +37,13 @@ jobs:
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag

- uses: actions-ecosystem/action-bump-semver@v1
- uses: thejeff77/action-bump-semver@v1.0.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use actions-ecosystem

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 about use of actions-ecosystem
If you do a PR to original repo it should stay as is. In your own repo feel free to override it.

id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: minor

- uses: actions-ecosystem/action-push-tag@v1
- uses: thejeff77/action-push-tag@v1.0.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use actions-ecosystem

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. +1 about use of actions-ecosystem

with:
tag: ${{ steps.bump-semver.outputs.new_version }}
message: '${{ steps.bump-semver.outputs.new_version }}: PR #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}'
Expand Down
57 changes: 52 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,63 @@
name: Actions Ecosystem Action Push Tag
description: Push a Git tag.
author: Actions Ecosystem
name: Push Any Git Tag
description: based on Actions Ecosystem Push Tag - Fixed with additional features.
author: Actions Ecosystem & theJeff77
Comment on lines +1 to +3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't change these. Nor do you need to put your name in as the author just because you PR.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


inputs:
tag:
description: A Git tag name.
type: string
required: true
message:
description: A message for the Git tag.
type: string
required: false
ref:
description: Commit SHA or ref (tag) to target for the tag.
type: string
required: false
force:
description: Whether or not to force push (overwrite) the tag if it already exists. Useful for walking tags.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This descriptions are not available for me when I read the docs or trying to see it will work for me

type: boolean
required: false
default: false
always-pass:
description: If this build step should pass no matter what if ref is missing and the tag push fails.
type: boolean
required: false
default: false
runs:
using: docker
image: Dockerfile
using: "composite"
steps:
Comment on lines +29 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is an unnecessary over reach on this PR. Just leave it in the Dockerfile and make your changes in the entrypoint.sh.

- name: Tag
shell: bash
run: |
tag=${{ inputs.tag }}
message=${{ inputs.message }}
ref=${{ inputs.ref }}
force=${{ inputs.force }}
alwaysPass=${{ inputs.always-pass }}

if [ "$force" = "true" ]; then
force="-f"
else
unset force
fi

if [ "$always-pass" = "true" ]; then
alwaysPass=" || true"
else
unset alwaysPass
fi

if [ -z "$ref" ]; then
ref="HEAD"
fi

git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

git tag -a "${tag}" "${ref}" -m "${message}" ${force} ${alwaysPass}
git push origin "${tag}" ${force} ${alwaysPass}
branding:
icon: search
color: yellow
12 changes: 0 additions & 12 deletions entrypoint.sh

This file was deleted.