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

I think your archive job always uploads yesterday‘s screenshot #1

Closed
Jwhiles opened this issue Nov 10, 2023 · 5 comments
Closed

I think your archive job always uploads yesterday‘s screenshot #1

Jwhiles opened this issue Nov 10, 2023 · 5 comments

Comments

@Jwhiles
Copy link

Jwhiles commented Nov 10, 2023

I like the idea of archiving your site everyday, and so I copied your action code. I realised that it actually upload yesterdays screenshot. (I only spotted this cos I had changed the page being screenshotted today).

The reason this happens is that actions are run on a specific commit, so even though the first job pushes an updated version of the repo, when the second job checks out the repo, it's still fetching the old commit.

I got around this by storing the screenshot as an artifact, you can see the change in this commit in case you want to make the same change here.

@spencerc99
Copy link
Owner

I like the idea of archiving your site everyday, and so I copied your action code. I realised that it actually upload yesterdays screenshot. (I only spotted this cos I had changed the page being screenshotted today).

The reason this happens is that actions are run on a specific commit, so even though the first job pushes an updated version of the repo, when the second job checks out the repo, it's still fetching the old commit.

I got around this by storing the screenshot as an artifact, you can see the change in this commit in case you want to make the same change here.

ahhh yeah I just made amends with it since it would eventually get everything haha. thank you for figuring out how to do it by avoiding checking out the repo entirely! gonna integrate this :) hope you enjoy your archive of website screenshots

@spencerc99
Copy link
Owner

i had also wanted to make it so it just commits every new photo to the repo (folder per side, with date as the name) rather than to s3.. you inspired me with this issue to try to get that working again but alas still seems unsupported (simonw/shot-scraper#130). if this is interesting to you and you figure it out let me know haha

@Jwhiles
Copy link
Author

Jwhiles commented Nov 11, 2023

I don't know enough python to be able to do this in a ”nice“ way. But I think you can do it with github actions relatively easily.

You could re-use the code you already have in the action to generate the file name, rename the file after the screenshot is created, and then the step that commits and pushes to the repo will handle everything else.

I tried this on my repo and it seems to work - yours would be a bit different because you have two screenshots - but I think you'd just need to add another mv :)

@spencerc99
Copy link
Owner

oh yeah ur a genius LOL updated it to do that :) thanks for the help

@Jwhiles
Copy link
Author

Jwhiles commented Nov 13, 2023

Nice! Glad that it's all working, and once again thanks for the idea - I'm just sad I didn't start this 5 years ago 😄

@Jwhiles Jwhiles closed this as completed Nov 13, 2023
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