GithubHelp home page GithubHelp logo

Comments (11)

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024 1

Thank you for sharing. This is indeed weird as there is nothing that explicitly changes the name of the file, the only path modifications are stripping off the source root and prefixing any destination root.

I'll take a look at this today, what runner are you using?

from action-azureblobupload.

andrewconnell avatar andrewconnell commented on August 23, 2024 1

Latest Ubuntu

from action-azureblobupload.

andrewconnell avatar andrewconnell commented on August 23, 2024 1

@LanceMcCarthy I chose to implement the upload using a different method back then. Bit swamped and the workflow works now so no offense if I don't get a chance to go back and test it out ¯_(ツ)_/¯

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

If you need to be up and running now, try the Docker-based Azure Blob upload action from Matthew Fisher https://github.com/marketplace/actions/azure-blob-storage-upload. The parameters are every similar to mine because the Azure SDK is the same for everyone.

In the meantime, I'll continue to test this.

Regarding the timestamp filename, that value seems to be coming from the environment variable CURRENT_DATESTAMP in the workflow. I don't use that variable in the Action, so I have no idea how that could possible become the filename.

However, I do have an ideas about where the 'als' part is coming from. Do you have a previous folder name that ends in als? For example, here's something I think make sense in the context

azblobupload/finals/filename.zip

The ../ in the source path is breaking the file path creation here

const cleanedSourceFolderPath = sourceFolder.replace(/\\/g, '/');
const cleanedFilePath = localFilePath.replace(/\\/g, '/');
let cleanedDestinationFolder = '';
core.debug(`sourceFolder: ${sourceFolder}`);
core.debug(`--- cleaned: ${cleanedSourceFolderPath}`);
core.debug(`localFilePath: ${localFilePath}`);
core.debug(`--- cleaned: ${cleanedFilePath}`);
if (destinationFolder !== '') {
// Replace forward slashes with backward slashes
cleanedDestinationFolder = destinationFolder.replace(/\\/g, '/');
// Remove leading and leading slashes
cleanedDestinationFolder = cleanedDestinationFolder
.split('/')
.filter(x => x)
.join('/');
core.debug(`destinationFolder: ${destinationFolder}`);
core.debug(`-- cleaned: ${cleanedDestinationFolder}`);
}
// Determining the relative path by trimming the source path from the front of the string.
const trimStartPosition = cleanedSourceFolderPath.length - 1;
const trimLength = cleanedFilePath.length - cleanedSourceFolderPath.length + 1;
const trimmedPath = cleanedFilePath.substr(trimStartPosition, trimLength);
let finalPath = '';
if (cleanedDestinationFolder !== '') {
// If there is a DestinationFolder set, prefix it to the relative path.
finalPath = [cleanedDestinationFolder, trimmedPath].join('/');
} else {
// Otherwise, use the file's relative path (this will maintain all subfolders).
finalPath = trimmedPath;
}
// Trim leading slashes, the container is always the root
if (finalPath.startsWith('/')) {
finalPath = finalPath.substr(1);
}
// If there are any double slashes in the path, replace them now
finalPath = finalPath.replace('//', '/');

from action-azureblobupload.

andrewconnell avatar andrewconnell commented on August 23, 2024

I'm uploading the files as artifacts so my short term solution is to manually download & upload the files. Not ideal, but the workflow is only manually run so not a big issue.

The timestamp is part of the filename I'm passing into the action. The als may be coming from the word "fundamentals" which is one of the two things I'm masking in the OP of this issue... but there's another word used that didn't generate that... which is strange.

The reason for the ".."in the filename is because of the variable ${{ github.workspace }} points to the cloned repo in the workspace. The location where the ZIP files are that I want to upload is parallel to that folder. If there was a way to get the value of the folder path for the root of the repo (and not the identical folder name one level down), I could use that... but can't figure how to get around that.

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

The workspace is typically one level down from where the commands are run. So you should be able to just use:

source_folder: ..\azblobupload

Let me know how that goes.

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

Also, I have This Prebuilt TypeScript Playground script that mimics the Action's work.

I use to test certain files paths to see what the outcome would look like without having to make a commit to GitHub, run the Action and wait for every tiny change

Put your string paths in these called out variables, run it and check out Logs pane

image

from action-azureblobupload.

 avatar commented on August 23, 2024

I'm also running into this issue. I suspect leading and trailing slashes in sourceFolder and localFilePath has an effect on the resulting trimmedPath. I tested in the TypeScript Playground (very useful!) and will submit a PR for review.

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

Thank you, I will review it today and push out a new release.

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

I have validated, built, test and released v1.8.3 to GitHub Actions Marketplace

  • @jacwil Thank you for opening the PR,
  • @andrewconnell Can you please let me know if you're seeing any problems after updating the workflow to use v1.8.3

If you'd like to see the specifics:

from action-azureblobupload.

LanceMcCarthy avatar LanceMcCarthy commented on August 23, 2024

@andrewconnell no offense taken! If you start a new project and need this again, I'm happy to help.

from action-azureblobupload.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.