If $G$ is a discrete or a Lie Group acting smoothly on a manifold $M$, we can define the algebra of $G$-invariant de Rham classes, $H(M)^G$, and we can also consider the cohomology of the sub-complex of $G$-invariant forms and its cohomology $H(\Omega(M)^G)$ which I note simply $H(M^G)$.


The injection $j:\Omega(M)^G \hookrightarrow \Omega(M)$ passes to cohomology as $j:H(M^G) \to H(M)$, and it is clear that $j(H(M^G)) \subset H(M)^G$, so there is the induced morphism
$$\bar j \colon H(M^G) \to H(M)^G$$
But $\bar j$ not injective since for $[\alpha]\_M^G \in H(M^G)$, $j([\alpha]\_M) = 0$ implies only that $\alpha = d\beta$ and $\beta$ has no reason to be $G$-invariant, so no reason why $[\alpha]\_M^G$ should be null.


I think that $\bar j$ neither surjective since for $[\alpha]\_M \in H(M)^G$, $g \cdot [\alpha]\_M = [g \cdot \alpha]\_M = [\alpha]\_M$ for all $g \in G$ implies only that $g \cdot \alpha = \alpha + d\beta$, so $\alpha$ is not necessarily $G$-invariant.


But is it possible that $[\alpha]\_M$ contains another $G$-invariant representant ?


Is there a simple counter-example showing that in general $\bar j$ is neither injective nor surjective ? For injectivity the example in @David's answer is OK, but quid for an example where surjectivité fails ?



Counterexample showing that G-invariant de Rham cohomology different from cohomology of G-invariant sub-complex?
If $G$ is compact, the inclusion $H(M^G) \to H(M)^G$ is an isomorphism. The inverse map is defined as follows: Take a class $\omega$ in $H(M)^G$ and lift it to a closed form $\alpha \in \Omega(M)$. Put $\beta = \int\_{g \in G} g^{\ast} \alpha$, where the integral is with respect to Haar measure normalized to have volume $1$. Clearly, $\beta \in \Omega(M)^G$. Our lift will map $\omega$ to $[\beta]$. 


We must check that $\beta$ is closed, is a de Rham representative of $\omega$, and that its class in $H(M^G)$ is independent of the choice of $\alpha$. Since all $g^{\ast} \alpha$ are closed, so is $\beta$. Since all $g^{\ast} \alpha$ are de Rham representatives of $\omega$, so is $\beta$. Finally, let $\alpha' = \alpha + d \eta$ be another lift of $\omega$. Then
$$\int\_{g \in G} g^{\ast} \alpha' = \int\_{g \in G} g^{\ast} \alpha + d \int\_{g \in G} g^{\ast} \eta$$
and $\int\_{g \in G} g^{\ast} \eta$ is in $\Omega(M)^G$.


When $G$ is not compact, both injectivity and surjectivity can fail. 


**Failure of injectivity**:
Consider $M = \mathbb{R}$ and $G = \mathbb{Z}$ acting by translations. The $1$-form $dx$ is closed and $G$-invariant on $\mathbb{R}$, but has no $G$-invariant integral. So it gives a nonzero class in $H^1(M^G)$, but of course $H^1(M)^G \subseteq H^1(M) = 0$.


**Failure of surjectivity** Let $M = S^1$. For $\theta \in \mathbb{R}$, define
$$\tilde{\phi}(\theta) = \theta + \tfrac{1}{2} \sin \theta.$$
Then $\tilde{\phi}: \mathbb{R} \to \mathbb{R}$ descends to a diffeomorphism $\phi: S^1 \to S^1$, with repelling and attracting fixed points at $\theta = 0$ and $\theta = \pi$ respectively. We let $G = \mathbb{Z}$, acting by $\phi$. 


The map $\phi$ acts trivially on $H^1(S^1)$. I claim that there is no nonzero smooth $\phi$-invariant $1$-form on $S^1$. Suppose for the sake of contradiction that $\omega$ is a $\phi$ invariant $1$-form.


Let $\omega = g(\theta) d \theta$ by $\phi$ invariant, and suppose for the sake of contradiction that $g(\theta\_0) \neq 0$ for some $\theta\_0 \not \in \pi \mathbb{Z}$. Then 
$$g(\phi^n(\theta\_0)) = \prod\_{k=0}^{n-1} (\phi')(\phi^k(\theta\_0))^{-1} g(\theta\_0).$$
As $k \to \infty$, $\phi^k(\theta\_0) \to \pi$ and $\phi'(\phi^k(\theta\_0))^{-1} \to 2$. So $g(\phi^n(\theta\_0)) \to \infty$ as $n \to \infty$, contradicting that $g(\theta) d \theta$ is supposed to be a continuous $1$-form.


**A perhaps nicer failure of surjectivity** Take a look at this [great post by Robert Bryant](https://mathoverflow.net/a/273689/297). Let $T$ be the torus $S^1 \times S^1$. Let $C\_0$ and $C\_{\pi}$ be the circles $\{ 0 \} \times S^1$ and $\{ \pi \} \times S^1$. Bryant constructs a flow (in other words, action of $\mathbb{R}$) which takes $C\_0$ and $C\_1$ to themselves, and where every other orbit approaches $C\_0$ as $t \to (-\infty)$, and $C\_1$ as $t \to \infty$, with **opposite orientations**. A picture is worth a thousand words: [Here](https://en.wikipedia.org/wiki/Reeb_foliation#/media/File:Reebfoliation-ring-2d-2.svg) is what the orbits of this flow looks like on one of the two cylinders of $T \setminus (C\_0 \cup C\_1)$. 
I claim that there is no flow invariant $1$-form with $\int\_{C\_0} \omega \neq 0$.


Let $f(t)$ be one of these nonclosed flows. For $T$ very positive, $f$ takes the interval $(T, T + 2 \pi)$ very close to $C\_1$ and, for $T$ very negative, it is very close to $C\_0$ with opposite orientation. So, if $\omega$ is a flow invariant continuous $1$-form, then 
$$\int\_{C\_0} \omega = \lim\_{T \to - \infty} \int\_T^{T+2 \pi} f^{\ast} \omega = \lim\_{T \to \infty} \int\_T^{T+2 \pi} f^{\ast} \omega = - \int\_{C\_1} \omega.$$


On the other hand, $C\_0$ and $C\_{1}$ are homologous so, if $\omega$ is closed, we have 
$$\int\_{C\_0} \omega = \int\_{C\_1} \omega.$$


Combining these, any closed flow-invariant $1$-form has $\int\_{C\_0} \omega=\int\_{C\_1} \omega=0$.


**One more and I'll shut up** Let $C$ be the cylinder $\mathbb{R}^2/\mathbb{Z}$, where we identify $(x,y)$ and $(x+k,y)$ for $k \in \mathbb{Z}$. Let the action of $\mathbb{Z}$ on $C$ be generated by $\phi(x,y) = (x,x+y)$. Let $\gamma$ be the image in $C$ of the line segment $(0,0)$ to $(0,1)$ in $\mathbb{R}^2$. Then $\phi(\gamma)$ is the image of the line segment from $(0,0)$ to $(1,1)$. So, if $\omega$ is a $\phi$-invariant $1$-form, then $\int\_{\gamma} \omega = \int\_{\phi(\gamma)} \omega$. But $\gamma - \phi(\gamma)$ is a $1$-cycle representing the nontrical class in $H\_1(C)$, so we deduce that any $\phi$ invariant $1$-form integrates to $0$ against this class.


