[PR #1239] ci: add pipeline for code formatting checks #2908

Closed
opened 2025-11-20 05:32:28 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/1239

State: closed
Merged: Yes


✍️ Description

This pull request introduces a new GitHub Actions workflow to check the formatting of shell scripts in the repository. The workflow runs on pushes to the main branch and on pull requests that modify .sh or .func files. The most important changes include setting up the workflow configuration, installing necessary tools, and posting comments on pull requests with the results of the formatting check.

New GitHub Actions workflow for shell script formatting:

  • Added script-formatting.yaml to .github/workflows to define a new workflow named "Validate script formatting" that triggers on push and pull request events for .sh or .func files.
  • Configured the workflow to run on ubuntu-latest and set up permissions for pull requests.
  • Included steps to checkout the code, set up Go, install shfmt, and get the list of changed files.
  • Added a step to run shfmt and capture the output, posting a comment on pull requests with the results.

It might be good to note that most files do not comply with the shfmt formatting style at the moment. So any new PRs will fail and should be fixed before merging.

The comment placed by the workflow has start and end tags, to make it possible to add more information to a single comment from other workflows. In code it looks like:

<!-- validate-formatting-start -->
### Script formatting

:rocket: All changed shell scripts are formatted correctly!


<!-- validate-formatting-end -->


🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

📋 Additional Information (optional)

I've tested this workflow on my own fork: https://github.com/se-bastiaan/ProxmoxVE/pull/1
With a run where it fails: https://github.com/se-bastiaan/ProxmoxVE/actions/runs/12612362624/job/35149014790?pr=1
And possible comments that are posted:
image
image

**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/1239 **State:** closed **Merged:** Yes --- ## ✍️ Description This pull request introduces a new GitHub Actions workflow to check the formatting of shell scripts in the repository. The workflow runs on pushes to the `main` branch and on pull requests that modify `.sh` or `.func` files. The most important changes include setting up the workflow configuration, installing necessary tools, and posting comments on pull requests with the results of the formatting check. New GitHub Actions workflow for shell script formatting: * Added `script-formatting.yaml` to `.github/workflows` to define a new workflow named "Validate script formatting" that triggers on push and pull request events for `.sh` or `.func` files. * Configured the workflow to run on `ubuntu-latest` and set up permissions for pull requests. * Included steps to checkout the code, set up Go, install `shfmt`, and get the list of changed files. * Added a step to run `shfmt` and capture the output, posting a comment on pull requests with the results. **It might be good to note that most files do not comply with the shfmt formatting style at the moment. So any new PRs _will_ fail and should be fixed before merging.** The comment placed by the workflow has start and end tags, to make it possible to add more information to a single comment from other workflows. In code it looks like: ```markdown <!-- validate-formatting-start --> ### Script formatting :rocket: All changed shell scripts are formatted correctly! <!-- validate-formatting-end --> ``` - - - - Related PR: #920 --- ## 🛠️ Type of Change Please check the relevant options: - [ ] Bug fix (non-breaking change that resolves an issue) - [x] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change unexpectedly) - [ ] New script (a fully functional and thoroughly tested script or set of scripts) --- ## ✅ Prerequisites The following steps must be completed for the pull request to be considered: - [x] Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.) - [x] Testing performed (I have thoroughly tested my changes and verified expected functionality.) - [ ] Documentation updated (I have updated any relevant documentation) --- ## 📋 Additional Information (optional) I've tested this workflow on my own fork: https://github.com/se-bastiaan/ProxmoxVE/pull/1 With a run where it fails: https://github.com/se-bastiaan/ProxmoxVE/actions/runs/12612362624/job/35149014790?pr=1 And possible comments that are posted: ![image](https://github.com/user-attachments/assets/c73688ab-9f3c-4868-b179-c0d1970acd46) ![image](https://github.com/user-attachments/assets/c3a5b0d9-4f97-4750-88f7-8486b2bc5696)
saavagebueno added the pull-request label 2025-11-20 05:32:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#2908