Drafts Action Directory

Working Copy round trip : fetch

Posted by @derekvan, Last update 3 months ago

This script will allow you to choose any file from a working copy repo and import it to Drafts. It also copies the universal URL of the file, so that when you use the associated “put” Drafts action, the file commits without needing any input from the user about where to save it.



  • script

    // Working Copy fetch
    // Grab file from working copy, prepend with universal URL link to facilitate git commit 
    const credential = Credential.create("Working Copy Key", "The URL key for Working Copy");
    credential.addTextField("key", "URL key");
    const key = credential.getValue("key");
    const baseURL = "working-copy://x-callback-url/read/?";
    var cb = CallbackURL.create();
    cb.baseURL = baseURL;
    cb.addParameter("type", "url");
    let success = cb.open();
    var wcf = CallbackURL.create();
    wcf.baseURL = baseURL;
    let good = wcf.open();
    let d = Draft.create();
    d.content = cb.callbackResponse.url + "\n" + wcf.callbackResponse.text;


  • After Success Default
    Notification Error
    Log Level Error


Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.