p4p1 / tryhackme-badge-workflow

A simple github action to retrieve tryhackme static badge image and display it on your profile README
https://github.com/marketplace/actions/tryhackme-badge-workflow
GNU General Public License v3.0
118 stars 6 forks source link

Image doesn't get committed #14

Open Letgamer opened 6 months ago

Letgamer commented 6 months ago

https://github.com/Letgamer/Letgamer https://github.com/Letgamer/Letgamer/actions/runs/8556624967/job/23446939621

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open './assets/thm_propic.png'
Emitted 'error' event on WriteStream instance at:
    at WriteStream.onerror (node:internal/streams/readable:773:14)
    at WriteStream.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:[12](https://github.com/Letgamer/Letgamer/actions/runs/8556624967/job/23446939621#step:3:13)2:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: './assets/thm_propic.png'
}

Apparently no commit is made and then the image is of course not found. I don't get why no commit is made, maybe it has todo with wrong permissions

p4p1 commented 6 months ago

I remember having a bug like this did you properly create the assets folder? the nodejs script does not create a assets folder so this might be the issues if after creating the folder the problem is still here you can also try and create a empty thm_propic.png file and then it should find the file to edit but that step should not be needed it's only a problem with the folder not existing if my memory is correct.

Letgamer commented 6 months ago

I tried that before opening the issue and it didn't work, but now somehow it worked?😅 But it still doesn't commit the file:

(node:1727) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    assets/thm_propic.png

nothing added to commit but untracked files present (use "git add" to track)
nothing to commit
Letgamer commented 6 months ago

I also created the https://github.com/Letgamer/Letgamer/blob/main/assets/thm_propic.png and now I get:

(node:1716) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   assets/thm_propic.png

no changes added to commit (use "git add" and/or "git commit -a")
nothing to commit

It states that the file was modified but it still is the same

Letgamer commented 6 months ago

looks like the Problem in https://github.com/p4p1/tryhackme-badge-workflow/issues/13 but I have a custom profile picture in THM

p4p1 commented 5 months ago

you should delete that file but keep the folder to see because I think git is getting confused and isnt able to add the file to the commit I don't know what would be causing this.

EDIT: so I just checked and I think this problem is actually everywhere because on my repo I have the same error for some reason I think the nodejs version or the git library used might be the issue since I haven't updated them since. I would need to debug this further I'll see when I have time for this and I'll close this issue once it's fixed if someone want's to fix this for me commits are more than welcome :)

Letgamer commented 5 months ago

Thanks for helping me out, I really appreciate the workflow :)