Cm and Gm chords can come from a shared scale although that scale could be either C minor or G minor. If you are familiar with roman numerals for chords, you would have i and v in C minor or iv and i in G minor. For the moment let's not worry about choosing between the two, and let's move on to the Am chord.
Am is not in C minor or G minor. Typically the use of that chord in either scale would be labelled as a borrowed chord. Borrowed chords being chords from the parallel key. The parallel key of C minor is C major, G minor's parallel key is G major. So Am is borrowed "vi" in C minor, and borrowed "ii" in G minor.
That give us the theory background regarding scales, key, and how to label the chords. Now on to what I think your actual question is.
So I think the scale of this track change every time...
I think you mean "the scale will change with each chord, because there is not one scale for all the chords."
I'll assume a simple tonal style where the chords and melody come from the same scale.
There is a shared scale for Cm and Gm so you do not need to change the scale between those two chords. It is not necessary to use the shared scale, but let's just be aware we can use a shared scale.
What happens in the melody over the Am chord - and how that may be perceived as a scale change - will depend on which notes are used. The important thing is to match up the Am chord tones to a given scale. Let's consider a single melody note over the Am chord, like this:
If the melody is "A" over the Am in G minor, then "A" is the 2nd
scale degree in G minor. Melody/scale-wise you don't leave the scale.
But we get the flavor of a borrowed chord.
If the melody is "C" over the Am in either G minor or C minor, then
the "A" is either the 4th degree or G minor of the tonic of C minor.
Again, we get the flavor of a borrowed chord, but the scale used for
the melody hasn't changed.
If the melody is "E natural" over the Am in either key, then the "E"
actual is from outside the minor scale. This would be a change to
the scale.
The rhythm is important in this regard. The three examples above would probably be long values (perhaps a vocal part.) If we use just one note, we can isolate that note to a common note between the borrowed chord and the scale in use.
If you were playing a faster rhythm - like a fast guitar solo - we can't really isolate the melody to just the common tones. To get the melody matching the chord it will change the scale. So again rhythm is important.
Of course you can play anything you want over those chords. You can pick scales that don't "match" the chords. My answer assumes a typical approach where melodies and scales match chords.
If you do not want a clear change in scale, use common tones between the chord and scale.
Otherwise, change the scale and listen to the contrast or expressive effect it provides.
These are choices you can make.