Improve CDN purge task

- Pull out duplicated run into variables.
- Remove unused import.