I created a website using Gatsby and deployed to Azure Static Web App using github actions.
The github action is not deleting the old files and folders that are deleted from repository.
And I couldn't find a way to delete those files even manually from Azure Static Web App.
Can you clarify which old files and folders these are? After removing these files from your repo do you see a successful GitHub Action run?
Can you clarify which old files and folders these are? After removing these files from your repo do you see a successful GitHub Action run?
After removing some files and folders from repo, I see a successful github action, and it deploys it successfully to Azure Static Web App, but the removed items are still visible in my website.
If the repo is public do you mind sharing? Also do you have the site url where you can access the deleted files?
If the repo is public do you mind sharing? Also do you have the site url where you can access the deleted files?
Ok great, and which file is being served that should not?
Ok great, and which file is being served that should not?
There was 2 folders under this path: src/content/work which are deleted (deleted folders were named Google, and Facebook with some files inside it) now but you can still see the contents coming in the url that I've sent. you can see the changes in this commit.
Can you try opening the site in an incognito window and see if the content is still showing up? I am not able to see anything.
My best guess is that your service worker is affecting how the content is being cached and so you are seeing stale versions of your content.
Can you try opening the site in an incognito window and see if the content is still showing up? I am not able to see anything.
My best guess is that your service worker is affecting how the content is being cached and so you are seeing stale versions of your content.
yeah that's the first thing came into my mind too, so I did it already, and it's showing up. it seems it's not related to cache.
That makes sense, yes doesnt appear to be that. Can you try making another commit to your repo and see if that unblocks you? I cloned and built your repository and confirmed that the produced resume page is different than what we are serving. I imagine there is a chance that the GitHub Action did not trigger on a commit and that led to this state. If you push again and it still doesnt update then something deeper is incorrect.
That makes sense, yes doesnt appear to be that. Can you try making another commit to your repo and see if that unblocks you? I cloned and built your repository and confirmed that the produced resume page is different than what we are serving. I imagine there is a chance that the GitHub Action did not trigger on a commit and that led to this state. If you push again and it still doesnt update then something deeper is incorrect.
I did push a new commit, the result is still the same.
is there anyway that we can see the files in Azure storage account?
Just an update here, I was able to confirm that the GitHub action actually is building the content with this extra content. I've sent a message to the Oryx team who is doing the detection and build step here who will help us debug the issue.
cc @kichalla
Thought I'd chime in here as I stumbled upon this ticket whilst playing around with that same Gatsby starter project with Azure Static Web Apps.
As hosseinnassiri points out the Resume page shows lots of extra things when built with Github actions, but when you build it locally it works fine.
What I've noticed is that this is due to the folder src\content\work. If you change that folder from "work" to something else (e.g. "experience") and update the GraphQL to point to "experience" instead. Push it, then everything works fine.
I can only assume that Oryx must place all the files under a "work" folder somewhere whilst building (as the extra things showing in your page arn't old entries, they are your blog post and project entries) which is confusing gatsby when building as its using that graphql to pull back everything in the "work" folder.
Potentially the bug here with oryx is that its creating a work folder with all content in it that graphql is incorrectly being picked up on.
Simple enough to work around the problem if you rename that folder in your source code though.