Coder Social home page Coder Social logo

Comments (8)

vlymar avatar vlymar commented on July 25, 2024 4

${GITHUB_REF:11}? is that a typo or is that really what's needed?

Sadly it is not a typo 😄 . It's a bash trick for string manipulation, basically says "return $GITHUB_REF starting at character position 11 (trims off refs/heads/)."

I'm currently working on first class support for Github actions v2 for ld-find-code-refs, so I'd recommend waiting for that to land. I expect to have it ready this week.

Edit: see "Substring Extraction" on https://www.tldp.org/LDP/abs/html/string-manipulation.html

from find-code-references.

HoughIO avatar HoughIO commented on July 25, 2024 4

You're a beast!
Thanks for your support!

from find-code-references.

vlymar avatar vlymar commented on July 25, 2024 3

Hi @HoughIO, thanks for the report. We were internally aware of this issue but dropped the ball on addressing it.

As you've already determined, github actions v2 contains a breaking change. v1 cloned the repo into the action container and checked it out to the correct branch. v2 removes this functionality and asks the user to manually include the actions/checkout step. Unfortunately that action leaves the repo in a detached head state rather than checked out to a branch, like in v1.

The fix is simple - we need ld-find-code-refs to read the branch name from $GITHUB_REF rather than try to get it from git as we do now. Until we make that change, there is a hacky workaround for getting this v2 action to work. You could add the following action in between actions/checkout and the code references action:

- name: Prepare repository
  run: git checkout "${GITHUB_REF:11}"

This just gets the repo out of the detached head state so the current version of ld-find-code-refs can run.

My recommendation would be to wait on using this v2 action until we have shipped v2 compatibility to ld-find-code-refs. I will post again to this issue when that is done.

Thanks, and apologies for the trouble.

from find-code-references.

victorquinn avatar victorquinn commented on July 25, 2024 1

${GITHUB_REF:11}? is that a typo or is that really what's needed?

from find-code-references.

HoughIO avatar HoughIO commented on July 25, 2024

Although taking another look at this, the new format requires the codebase to be cloned with the actions/checkout@v1 action located here. Which seems to not be a specific branch, but checks out the ref based on the pull request data sent in the payload.

from find-code-references.

HoughIO avatar HoughIO commented on July 25, 2024

That's a good hack!
GITHUB_REF

The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. If neither a branch or tag is available for the event type, the variable will not exist.
--

So it would be the current branch!
Neat!

from find-code-references.

victorquinn avatar victorquinn commented on July 25, 2024

Slick!

from find-code-references.

vlymar avatar vlymar commented on July 25, 2024

This issue is fixed in the v2 release of find-code-references.

If you update your workflows to uses: launchdarkly/find-code-references@v2 things should just work.

Thanks for the reports!

from find-code-references.

Related Issues (16)

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.