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

onlyDifferent input parameter? #2

Closed
jfaMan opened this issue Dec 21, 2023 · 2 comments
Closed

onlyDifferent input parameter? #2

jfaMan opened this issue Dec 21, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jfaMan
Copy link

jfaMan commented Dec 21, 2023

I have a suggestion. Is it possible to add an input parameter similar to onlyNewer but instead of uploading files with a more recent modification date upload files if the modification date has simply changed?

In my case, I'm using this in a workflow to deploy theme files to WordPress. By default or setting onlyNewer to true speeds up the workflow run time, but the issue I have is if someone was to go into the WordPress theme file editor and directly make changes to a file, that file would now have a more recent modification date to the file in the source repository. This means when running the workflow and deploying, that file won't upload, the changes to that file will persist and will never be in sync until a new commit modifies that source file and makes it 'newer'.

To ensure the theme files on WordPress are always 100% in sync with the source repository, I could set onlyNewer to false but that would increase the workflow run time as now every file has to be uploaded again regardless of whether it has changed or not.

I guess just the possibility of deployed files not actually being deployed in this scenario made me think of this. Maybe it's a bit of an edge case though, so just using onlyNewer false even if it takes longer would be best to avoid the possibility? Just a suggestion anyway.

@over-engineer
Copy link
Member

Hey, @jfaMan!

That’s a great idea — thanks for taking the time to suggest that.

This was addressed in v1.1.0 (the v1 tag also points to the latest commit), by introducing a restoreMTime input, which allows you to restore the modification time of the files via git, even when onlyNewer is set to false.

So, to upload files when the modification date is different, you’ll need to set onlyNewer to false, and restoreMTime to true.

For example,

- name: Deploy files via SFTP
  uses: pressidium/lftp-mirror-action@v1
  with:
    host: ${{ secrets.SFTP_HOST }}
    port: ${{ secrets.SFTP_PORT }}
    user: ${{ secrets.SFTP_USER }}
    pass: ${{ secrets.SFTP_PASS }}
    onlyNewer: false
    restoreMTime: true
    remoteDir: '/var/www/html/example.com/public'

Let me know if you need any clarification 🙂

@over-engineer
Copy link
Member

Closing as resolved. Feel free to reopen this, if there’s anything I overlooked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants