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

Get output fileID of CurseForge to append to URL #6

Closed
Macleykun opened this issue Nov 20, 2021 · 7 comments
Closed

Get output fileID of CurseForge to append to URL #6

Macleykun opened this issue Nov 20, 2021 · 7 comments

Comments

@Macleykun
Copy link

When a file/mod is uploaded to CF, it'll be displayed under the following URL:
https://www.curseforge.com/minecraft/mc-mods/notfmcplease/files/3531003

That last part: 3531003 is something i would want to append to a message i post on discord like:

messagefordiscord: Hey you can download the file at: https://www.curseforge.com/minecraft/mc-mods/notfmcplease/files/${{ thatfile_id }}

I'm pretty sure you've already included this at: https://github.com/itsmeow/curseforge-upload/blob/master/action.yml#L38
But i'm not sure what the name of that variable is :P

@itsmeow
Copy link
Owner

itsmeow commented Nov 20, 2021

The name is id! so steps.upload.outputs.id, in the workflow you have to set the id of the step to upload to access it with that notation

@itsmeow
Copy link
Owner

itsmeow commented Nov 20, 2021

jobs:
  example:
    steps:
    - uses: actions/checkout@v1
    - name: Upload
      id: upload
      uses: itsmeow/curseforge-upload@master
      with:
        # ...
    - name: Discord
      content: https://curseforge.com/.../${{steps.upload.outputs.id}}

@itsmeow itsmeow closed this as completed Nov 20, 2021
@Macleykun
Copy link
Author

Heya! thank you for the solution!
I also wanted to ask (sorry i though i made another issue for this) if it's possible to refer to a file to fill in the changelog!

I'm trying to take out the part of a changelog file into a variable to then use in the changelog input, but it's not working out for me.
Is it possible to add this feature to you action? I really love the action you made and i've almost fully automated the CI/CD for a friend :D

@itsmeow
Copy link
Owner

itsmeow commented Nov 20, 2021

Look on the action marketplace for an action that reads text files, then you can use output from that! Workflows are modular, so mix them up!

@Macleykun
Copy link
Author

Macleykun commented Nov 20, 2021

True, but i've already gotten a way to extract the part of a changelog.md:
https://github.com/Macleykun/Future-MC/blob/Improved-CI/.github/workflows/autobuilds.yml
More specific:
awk -v version='0.2.7.4' '/## Version / {printit = $3 == version}; printit;' 'changelog.md' | awk '!/^$/'
Which gives the perfect output (0.2.7.4 is normally a var). But i can't get this output into a (env) variable for:

https://github.com/Macleykun/Future-MC/blob/Improved-CI/.github/workflows/autobuilds.yml#L73

I've tried different ways, like using echo and inserting the var into the $GITHUB_ENV like i do with the others, but it always returned an empty var back. When using the command on a Linux machine locally it works

If your action can accept a file as an input to read from for the changelog input, then people only have to extract what's needed/delete what isn't needed from their changelog.md!

Unless i've completely missed an action that can read from a file, cut the part we want and input it straight into a multi lined var :P.

My friend uses this: https://github.com/Macleykun/Future-MC/blob/Improved-CI/changelog.md to make his changelog, an i want to use the latest version part into the changelog on CF :D

@Macleykun
Copy link
Author

Macleykun commented Nov 20, 2021

So i've fixed most of my issue but, i don't think it's possible to have a multi-lined markdown env variable for the input of the changelog: https://github.com/Macleykun/Future-MC/runs/4275394553?check_suite_focus=true

perhaps if we could use a command in the input changelog or giving a file (that's already been trimmed) would solve/help!

@Macleykun
Copy link
Author

Managed to fix it by doing this:
https://github.com/Macleykun/Future-MC/blob/Improved-CI/.github/workflows/autobuilds.yml#L57

      echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
      awk -v version='${{ env.VERSION }}' '/## Version / {printit = $3 == version}; printit;' 'changelog.md' | awk '!/^$/' >> $GITHUB_ENV
      echo 'EOF' >> $GITHUB_ENV

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

2 participants