Invariants and base change Suppose $R$ is a Noetherian commutative ring, and $M$ a finite free $R$-module, with an action of a finitely generated discrete group $G$ by $R$-linear maps.  
Is there any homological condition on this data which would ensure that taking $G$-invariants commutes with base change?
That is, for any finite type map $R \rightarrow S$, we have
$$(M \otimes S)^G = (M^G)\otimes S.$$
For instance, suppose $M^G = 0$?
 A: Choose generators $g_1,\dots,g_n$ of $G$ and let $f\colon M\to M^n$, $f(m)=(g_im-m)_{i=1,\dots,n}$. This gives an exact sequence $$0\to M^G\to M\to M^n\to\mathrm{coker}(f)\to0$$ which can be interpreted (EDITED) as part of a flat resolution of $\mathrm{coker}(f)$. Since $\ker(f\otimes1_S)=(M\otimes S)^G$, the quotient $(M\otimes S)^G/\mathrm{im}(M^G\otimes S)$ may be identified with $\mathrm{Tor}_1(\mathrm{coker}(f),S)$, so they both vanish for all $S$ iff $\mathrm{coker}(f)$ is flat. If $\mathrm{coker}(f)$ is flat, we also get that $M^G\otimes S\to(M\otimes S)^G$ is injective, so we get the equivalence $M^G\otimes S\to(M\otimes S)^G$ bijective iff $\mathrm{coker}(f)$ is flat.
A: Under the assumption, that $G$ operates as guessed in my comment, one can proceed as follows: 
First note, that the conditions make $M$ a $RG$-module. For every $RG$-module $N$, it holds: 
$$N^G \cong Hom_R(R,N)^G\cong Hom_{RG}(R,N)= Ext^0_{RG}(R,N) =: H^0(G;N)$$
with natural $R$-module isomorphisms. Since $M$ is $R$-torsion-free, the universal coefficient theorem applies, yielding a short exact sequence of $R$-modules (that's where to assumption about the $G$-operation on the tensor product comes into play): 
$$0 \to H^0(G;M) \otimes_R S \to H^0(G;M \otimes_R S) \to Tor_1^R(H^1(G;M),S) \to 0.$$
Thus $M^G \otimes S = (M \otimes S)^G$ is equivalent to the vanishing of the Tor-term. Hence we have as a homological criterion:

$$Tor_1^R(H^1(G;M),S) = 0 \text{  for every } R \to S.$$

A sufficient condition is therefore: $H^1(G;M)$ is a flat $R$-module. 
Note: $G$ can be an arbitrary group, the finitely generated assumption isn't used. 
Edit: In order to apply the universal coefficient theorem (UCT), one has to require $R$ to be hereditary and $M$ to be a projective $R$-module (if $M$ is supposed to be a finitely generated projective $R$-module, it sufficies if $R$ is semi-hereditary). 
Remark 1: Hereditary means that submodules of projective modules are again projective; semi-hereditary means that submodules of finitely generated projective modules are again projective. For instance, Dedekind domains are hereditary and Prüfer domains are semi-hereditary. 
Remark 2: For the convinience of the reader let me include the way, I use UCT: According to Weibel's homological algebra book (Theorem 3.6.1): If $P$ is a chain complex of flat $R$-modules such that for each $n$, $d(P_n)$ is a flat submodule of $P_{n-1}$, then the following sequence is exact for every $R$-module $S$: 
$$0 \to H_n(P) \otimes_R S \to H_n(P \otimes_R S) \to Tor_1^R(H_{n-1}(P),S) \to 0.$$
Now, assume $M$ is a projective $R$-module, $X$ is a free resolution of $R$ over $RG$ such that each $X_n$ is a free $RG$-module of finite rank (for example one can take the bar resolution) and set $P := Hom_{RG}(X,M)$. Then, as $R$-modules: 
$$P_n \cong Hom_{RG}((RG)^k,M) \cong \oplus_1^k Hom_{RG}(RG,M) \cong M^k$$ 
is a projective, thus flat $R$-module and by hereditary the conditions of UCT are fullfilled. Futhermore, one has to note that 
$$Hom_{RG}(X,M) \otimes_R S \cong Hom_{RG}(X,M \otimes_R S)$$ holds, since $X_n$ is a free $RG$-module of finite rank and my assumption about the $G$-operation on the tensor product (!). 
