In the firmest voice he uses in public, Giants manager Bruce Bochy said during batting practice Friday, “We have not stopped playing. Nobody here is saying the season is over.”

That includes closer Mark Melancon, who will continue to pitch in a lesser role despite acknowledging for the first time that he is weighing surgery to repair the forearm-muscle injury that has plagued him since spring training.

Melancon reiterated that the ligament is intact, and team doctors have told the staff that the 32-year-old reliever is able to throw without risking a more significant injury.

“If we thought that (Melancon could be at risk), we would not let him pitch,” Bochy said.

Neither Melancon nor head athletic trainer Dave Groeschner would divulge what type of surgery Melancon would have until a decision is made whether to proceed. Groeschner said whether Melancon goes under the knife or attempts to rehab without surgery, the goal is to have him 100 percent healthy by the start of spring training.

“That’s the most important thing we continue to weigh day to day,” Groeschner said.

Melancon twice has gone on the disabled list with the strained pronator muscle, an injury that has limited him to 25 games in his first season with the Giants. It causes pain where the muscle connects to his elbow.

Melancon revealed he has had this injury on and off since 2012. In past years, it “subsided.” This year, it has not.

The issue did not prevent Melancon from saving a combined 47 games for the Nationals and Pirates last year. Nor did it dissuade the Giants from giving him a four-year, $62 million contract.

Melancon said he has been in discomfort every day this season, notwithstanding the rest he got while on the DL. Asked why he would continue pitching with an injury that might require surgery when the Giants are not in contention, he said, “That’s a good question.

“I mostly want to make sure the guys understand, first of all, that I want to be out there and show the importance of battling back and fighting through. We have a lot to prove still this year even though we’re not going to the playoffs.

“These seven weeks blend into next year. They set a tone for next year. It’s important to continue that and set a foundation. Those intangibles are important.”

That sentiment dovetails with Melancon’s comment earlier this season that the Giants signed him not merely to pitch the ninth inning, but also be a leader for a young bullpen.

Bochy is treating Melancon gingerly, not allowing him to pitch on back-to-back days. He has become Bochy’s seventh-inning man, preceding Hunter Strickland in the eighth and Sam Dyson in the ninth in protecting leads.

Since Dyson’s acquisition in June, he has been the shutdown closer Melancon was supposed to be. Dyson earned his 10th save in 11 chances Thursday night. His blown save began with a misplay by third baseman Conor Gillaspie at Dodger Stadium.

Melancon was asked if he hopes to resume closing this year. He answered diplomatically, saying, “Sam’s doing great. It’s something we’ll talk about. I want him to continue to do well.”

Melancon acknowledged he is risking injury to other parts of his arm by compensating for the elbow pain, but said he is being hyper-vigilant to ensure that does not happen.

He stressed he wants to set an example, and his teammates have noticed. After Melancon helped preserve Jeff Samardzija’s victory Thursday, Samardzija said, “You really tip your hat to that guy.”

Groeschner also praised Melancon’s desire to pitch and said, “He’s manning up. You’ve got to give him a lot of credit.”

Henry Schulman is a San Francisco Chronicle staff writer. Email: hschulman@sfchronicle.com Twitter: @hankschulman