This article presents a search for flavour-changing neutral currents in the decay of a top quark into an up-type (q = c, u) quark and a Higgs boson, where the Higgs boson decays into two photons. The proton-proton collision data set analysed amounts to 36.1 fb−1 at s=13 TeV collected by the ATLAS experiment at the LHC. Top quark pair events are searched for, where one top quark decays into qH and the other decays into bW. Both the hadronic and leptonic decay modes of the W boson are used. No significant excess is observed and an upper limit is set on the t → cH branching ratio of 2.2 × 10−3 at the 95% confidence level, while the expected limit in the absence of signal is 1.6 × 10−3. The corresponding limit on the tcH coupling is 0.090 at the 95% confidence level. The observed upper limit on the t → uH branching ratio is 2.4 × 10−3.[Figure not available: see fulltext.].