Skip to content

🧩 Prettier GitHub Action does not commit fixes automatically #151

Description

@idna001

🐞 Summary

The new Prettier GitHub Action successfully runs and detects formatting issues,
but when it tries to fix and commit the changes, the commit step doesn’t complete successfully.

⚙️ Current Behavior

  • The action runs Prettier correctly and identifies formatting errors.
  • It formats the files locally in the CI environment.
  • However, no commit is pushed back to the branch, and the PR remains unformatted.

🎯 Expected Behavior

When Prettier finds and fixes formatting issues,
it should automatically commit and push the formatted files back to the current branch.

💡 Possible Causes

  • Incorrect configuration in the commit step (missing git config user.name or git config user.email).
  • It should use the user of the creating the PR

🧠 Suggested Fix

  • Verify that the workflow uses a valid token with contents: write permission.
  • Add a configuration step for git user.name and git user.email before committing.
  • Optionally, test the action on a branch within the main repo instead of a fork.

✅ Goal

Ensure that the Prettier GitHub Action can automatically:

  1. Run prettier --write .
  2. Commit the changes
  3. Push them to the same branch that triggered the workflow

Labels: bug, github-actions, hacktoberfest, enhancement
Difficulty: 🟡 Medium
Status: Open for contributors

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions