Giter Club home page Giter Club logo

Comments (6)

0ui avatar 0ui commented on June 20, 2024

I also ran into the error message fatal: bad object type. in a reusable workflow. I unfortunately still don't know exactly what cause the issue but I was able to fix it by manually creating and pushing a new tag.

This may be a fundamentally different problem from yours but posting for anyone this might help:

  1. my action was failing to create a tag pointing to HEAD and my latest tag was for HEAD~2
  2. I manually created and pushed a tag for HEAD~1
  3. the following action run was fixed and successfully created a tag for HEAD

from action-create-tag.

cmpilato avatar cmpilato commented on June 20, 2024

I finally found something that seems to have worked. I changed the YAML stanza that I use to checkout the to-be-tagged repo to include the parameters fetch-depth: 0 and fetch-tags: true. The resulting block now looks like this:

      # https://github.com/actions/checkout
      - uses: actions/checkout@v3
        with:
          ref: "${{ inputs.ref }}"
          fetch-depth: 0
          fetch-tags: true

I'll close this issue now. (If @0ui or others want to reopen it, knock your-collective-selves out.)

from action-create-tag.

rickstaa avatar rickstaa commented on June 20, 2024

Hey @cmpilato, great news on solving the issue! Apologies for the delayβ€”I was enjoying a holiday in the sun. β˜€οΈ

The fatal: bad object error pops up when the Git ref is invalid, usually due to a typo or the ref not existing anymore.

In your code, focus on this section:

entrypoint.sh#L33C1-L33C48

It appears the problem might be after:

entrypoint.sh#L37C48-L37C48

git tag -fa "${TAG}" "${SHA}" -m "${MESSAGE}"

Given your use of force_push_tag, the error likely lies in the SHA variable. If commit_sha isn't specified, it's sourced from GITHUB_SHA:

GITHUB_SHA documentation

GITHUB_SHA value varies based on the triggering event. Usually, it's the latest commit, but in your case, it equals the Last commit on the branch or tag that received the dispatch:

GitHub Actions - Workflow Dispatch

I think this might lead to the ref not existing in your action. As you observed, running actions/checkout with fetch-depth: 0 fixes it by ensuring all Git refs are fetched during checkout.

I hope this sheds light! If you reencounter issues, let's revisit the investigation πŸ‘πŸ».

from action-create-tag.

rickstaa avatar rickstaa commented on June 20, 2024

I improved the documentation (see #39).

from action-create-tag.

cmpilato avatar cmpilato commented on June 20, 2024

I improved the documentation (see #39).

Excellent! Hopefully, others will benefit from my missteps and your additional documentation.

from action-create-tag.

rickstaa avatar rickstaa commented on June 20, 2024

I improved the documentation (see #39).

Excellent! Hopefully, others will benefit from my missteps and your additional documentation.

Thank you for finding a use case which I did not think of and, by doing so, improving the action ❀️‍πŸ”₯.

from action-create-tag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.