Git Product home page Git Product logo

Comments (15)

metcalfc avatar metcalfc commented on August 24, 2024

Can you point me to the action definition you're using? Or if its private repo copy it here? It sounds like the output of the git log is getting run as a command.

from changelog-generator.

wibbuffey avatar wibbuffey commented on August 24, 2024

@datapolitical can you provide your action? to me it looks like you're using the output as a step (which, obviously, will run them as if they're commands)

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024

I think I found this. In my examples I just "echo" the action output. Which you are correct, contains backticks so that the sha's render in monospace in the markdown. So when you echo this output in bash it tries to execute the backticks.

If you need to "echo" this you can use this instead:

- name: Get the changelog
  run: |
    cat << "EOF"
    ${{ steps.changelog.outputs.changelog }}
    EOF

Otherwise you can use it in other actions like I do to fill out say the GitHub Release Notes.

- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false

Please reopen this issue if this doesn't solve your issue.

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

That makes sense. What I’m trying to do is follow your example here: #41

to reverse the output and remove lines that include “gh-pages”.

so I don’t need to output it specifically, I need to pipe it to

| sed -n '/gh-pages/!p' | tac

And then export that so I can use it in another step.

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

Also I don’t see an option to re-open the issue…

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024
- name: Get the changelog
  run: |
    cat << "EOF" | sed -n '/gh-pages/!p' | tac
    ${{ steps.changelog.outputs.changelog }}
    EOF

This should work. Here is an example I tested locally.

 cat << "EOF" | sed -n '/gh-pages/!p' | tac
`hi`
`something` gh-pages
`cool`
EOF

`cool`
`hi`

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

OK I've got that working, but how do I pipe that to an output so I can use it in a later step?

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

At the moment I'm trying this:

run: | 
  LOG=$(cat << "EOF" | sed -n '/gh-pages/!p' | tac
  ${{ steps.changelog.outputs.changelog }}
  EOF
  )
  echo "::set-output name=changelog_final::$LOG"
id: parsedlog

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024

Stay tuned. Its not working for me either and I am pretty sure it should. Ticket into GitHub Support.

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

So I was able to get this to work kind of:

 - name: Get the changelog
        id: parsedlog
        run: | 
          echo ::set-output name=changelog_final::$(cat << "EOF" | sed -n '/gh-pages/!p' | tac
          ${{ steps.changelog.outputs.changelog }}
          EOF
          )

      - name: Test Release Notes
        run: |
          echo "Release notes: ${{ steps.parsedlog.outputs.changelog_final}} "

Problem is that the output looks like this:

Release notes:  Gemfile Gemfile.lock Pipfile README.md _config.yml _config_dev.yml _data _plugins _posts android-chrome-192x192.png android-chrome-512x512.png apple-touch-icon-precomposed.png apple-touch-icon.png archive.html assets build crosswords.md diet.md drinks favicon.ico grady.md index.md manifest.json newsearch.md package.json posts.html recipes requirements.txt service-worker.js staticman.yml vendor [`a118319`](http://github.com/datapolitical/chrisfnicholson.github.io/commit/a118319b1e2988c4cc94b74da8b7c3d8b072b56e) - one more try

For some reason it's printing a list of all the files in the top level directory.

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024

I get this too. Its wild... Still waiting for support.

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

It's the * before each line.

It doesn't show up in the output . I bet it's parsing it as "cat *", which for some reason is giving us the list of files rather than their contents.

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024

Ok this was wild. So this all started with backticks... and that should have tipped me off to suddenly all the files are showing up. Why? Globs. The * at the front of the markdown to indicate an list item. echo expands it. So I used noglob for a bit. Then said forget it. I took out all the markdown markup that will mess with a shell.

But that wasn't all. That fixed most of it. But what happened then was that the newlines between entries were getting eaten. An hour of messing around later and I find out that outputs in Actions don't support multiple lines but there is a work around. So I updated the readme to include an example that should work.

- name: Modify the changelog
id: modified
run: |
set -o noglob
log=$(cat << "EOF" | grep -v Bumping | tac
${{ steps.changelog.outputs.changelog }}
EOF
)
log="${log//'%'/'%25'}"
log="${log//$'\n'/'%0A'}"
log="${log//$'\r'/'%0D'}"
echo "::set-output name=modified::$log"
- name: Print the modified changelog
run: |
cat << "EOF"
${{ steps.modified.outputs.modified }}
EOF

from changelog-generator.

metcalfc avatar metcalfc commented on August 24, 2024

Because the output of the action has changed I went ahead an cut a new major release. I don't think anyone relied on stars or backticks... but just in case. This should resolve #93.

from changelog-generator.

datapolitical avatar datapolitical commented on August 24, 2024

This worked great, thank you.

from changelog-generator.

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.