This seems to mean that salvation depends on actions and is not just by faith alone.
No. It's the other way around: One's actions depend upon one's faith.
Faith brings repentance, which brings a change of attitude, which brings a change of behaviour.
Immoral people obviously don't truly have faith, otherwise they would repent of their attitude and so no longer be immoral.
This is part of the disagreement that Paul and James appear to have, caused by people's misunderstanding of Paul's statements.
- Paul correctly states that works can't earn salvation.
knowing that a man is not justified by the works of the law but by faith in Jesus Christ, even we have believed in Christ Jesus, that we might be justified by faith in Christ and not by the works of the law; for by the works of the law no flesh shall be justified.
— Galatians 2:16
Do you see that faith was working together with his works, and by works faith was made perfect?
You see then that a man is justified by works, and not by faith only.
For as the body without the spirit is dead, so faith without works is dead also.
— James 2:22,24,26
- People misinterpret James as saying that Paul was wrong.