statamic / spock

Automatically perform git commits, pushes, and other cli actions when Statamic content changes
95 stars 16 forks source link

Spock doesn't track unpublished collection entry #24

Open aerni opened 6 years ago

aerni commented 6 years ago

When unpublishing a collection entry, Spock adds, commits and pushes the unpublished file with the underscore e.g. _entry.md as expected. But it doesn't track the deleted file entry.md. I had to add, commit and push it myself. Great, if this can be fixed.

aerni commented 6 years ago

The same thing happens when publishing an unpublished entry. Spock adds, commits and pushed the published file e.g. entry.md but doesn't track the deleted file _entry.md.

jesseleite commented 6 years ago

Oh interesting. Maybe we should be firing an event for that from Statamic... Will look into it, thanks!

jesseleite commented 6 years ago

Can't reproduce.

commit 93c4795e7649b64892005edd32fb07769921ed3e (HEAD -> testing)
Author: Captain Spock <captainspock@statatmic.com>
Date:   Fri Oct 26 11:02:06 2018 -0400

    Entry saved by jlo

diff --git a/app/site/content/collections/things/_a-new-entry-from-spock.md b/app/site/content/collections/things/a-new-entry-from-spock.md
similarity index 100%
rename from app/site/content/collections/things/_a-new-entry-from-spock.md
rename to app/site/content/collections/things/a-new-entry-from-spock.md

It's committing both fine for me 🤔 What versions of statamic and spock are you running?

wanze commented 5 years ago

I am also running into this issue using the following setup:

Ignored events:

  - Statamic\Events\Data\AssetUploaded
  - Statamic\Events\Data\AssetMoved
  - Statamic\Events\Data\AssetDeleted
  - Statamic\Events\Data\FileUploaded

My current solution is to use a custom after command:

- if (( $(git status -s | wc -l) > 0 )); then git add --all && git commit -m "[skip-ci] Additional changes after running Spock" && git push; fi