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

tag_exists_error: false still errors if tag already exists on remote. #35

Open
brandon-kyle-bailey opened this issue Jun 28, 2023 · 5 comments

Comments

@brandon-kyle-bailey
Copy link

Describe the bug
Docs state the argument:

tag_exists_error: false

Prevents the action from failing if the tag already exists. But it appears the action still errors and fails due to the given tag existing even with this parameter provided.

To Reproduce
Steps to reproduce the behavior:

  • Create tag
  • configure action with tag_exists_error: false
  • run action on existing tag
  • see error

Expected behavior
Action should not error if tag already exists when tag_exists_error: false is present.

Screenshots
image

image

Additional context
Add any other context about the problem here.

@brandon-kyle-bailey brandon-kyle-bailey changed the title tag_exists_error: false still errors is tag already exists. tag_exists_error: false still errors if tag already exists. Jun 28, 2023
@brandon-kyle-bailey brandon-kyle-bailey changed the title tag_exists_error: false still errors if tag already exists. tag_exists_error: false still errors if tag already exists on remote. Jun 28, 2023
@rickstaa
Copy link
Owner

rickstaa commented Jul 4, 2023

@brandon-kyle-bailey Thanks for your bug report. That, indeed, shouldn't happen. It looks like

https://github.com/rickstaa/action-create-tag/blob/07b918ecbf94359b859f25f7a70553a84e804923/entrypoint.sh#L28C8-L30

doesn't flag the tag as already existing. I will investigate this issue later this week 👍🏻.

@brandon-kyle-bailey
Copy link
Author

Thanks @rickstaa !

@rickstaa
Copy link
Owner

Hi @brandon-kyle-bailey! Apologies for the delay, but I finally got around to investigating the issue you raised. I took a look at the provided action recipe, and after attempting to reproduce the problem, it seems I'm not encountering the issues you described. The workflow run here appears to be successful on my end 🤔.

A few potential culprits crossed my mind that might be causing your problem:

  1. Insufficient permissions: It's possible that your action might be suffering from a lack of permissions to create a tag. Double-check if the action has the necessary permissions.

  2. Output Quirks: Ensure that the output from steps.package-version.outputs.new-version is formatted correctly. An incorrect format could cause problems.

  3. Tag Protection Troubles: Do you have any tag protection rules in place? These rules might prevent your action from creating tags.

I will close this issue for now. Feel free to comment below if there is anything else you'd like me to dive into!

@rickstaa rickstaa closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2023
@Narcha
Copy link

Narcha commented Jun 10, 2024

I encountered the same issue. Interestingly enough, the runner log seems to indicate that the input variable (INPUT_TAG_EXISTS_ERROR) is not set.

Run rickstaa/action-create-tag@v1
  with:
    tag: latest
    tag_exists_error: false
    github_token: ***
    force_push_tag: false
    no_verify_tag: false
/usr/bin/docker run --name e6bc307835efdbf9484f9e90ac9f36b7e512ca_57c467 --label e6bc30 --workdir /github/workspace --rm -e "INPUT_TAG" -e "INPUT_TAG_EXISTS_ERROR" -e "INPUT_GITHUB_TOKEN" -e "INPUT_MESSAGE" -e "INPUT_COMMIT_SHA" -e "INPUT_FORCE_PUSH_TAG" -e "INPUT_NO_VERIFY_TAG" -e "INPUT_GPG_PRIVATE_KEY" -e "INPUT_GPG_PASSPHRASE" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/[redacted]/[redacted]":"/github/workspace" e6bc30:7835efdbf9484f9e90ac9f36b7e512ca
[action-update-semver] Setup git user name and email.
[action-create-tag] Create tag 'latest'.
[action-create-tag] Push tag 'latest'
To https://github.com/[redacted]
 ! [rejected]        latest -> latest (already exists)
error: failed to push some refs to 'https://github.com/[redacted]'
hint: Updates were rejected because the tag already exists in the remote.

Edit: I think I misunderstood the -e flag of docker run. The variable is probably set, assuming it is set in the executing shell.

@rickstaa rickstaa reopened this Jun 10, 2024
@MaSch0212
Copy link

I had the same issue. When I checked my checkout task, I noticed that the tags are not fetched, so I added fetch-depth: 0 to my checkout task. That solved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants