Skip to content

Conversation

@devmotion
Copy link
Member

This PR should make the cleanup action a bit safer. Currently it fails if the preview does not exist, e.g., if a PR is opened from a fork (e.g., #261).

Comment on lines 23 to 24
env:
PRNUM: ${{ github.event.number }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want to delete that 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha no 😄

- name: Delete preview and history + push changes
run: |
git push --force origin gh-pages-new:gh-pages
if [ -d "previews/PR$PRNUM" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also where does the [ -d ] syntax comes from? I could not find anything in the docs...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just bash syntax. It checks if the folder actually exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

@devmotion
Copy link
Member Author

Let's see if it works as expected the next time someone opens a PR from a forked repository.

@devmotion devmotion merged commit ae78b73 into master Mar 22, 2021
@devmotion devmotion deleted the devmotion-patch-2 branch March 22, 2021 17:23
@devmotion
Copy link
Member Author

At least it worked for this PR, so we didn't break the existing setup 🙂

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

Successfully merging this pull request may close these issues.

3 participants