https://github.com/cssnr/check-build-action
Action to Check if the provided Build command was run and Optionally Comment on the PR.
https://github.com/cssnr/check-build-action
actions
Last synced: 17 days ago
JSON representation
Action to Check if the provided Build command was run and Optionally Comment on the PR.
- Host: GitHub
- URL: https://github.com/cssnr/check-build-action
- Owner: cssnr
- License: gpl-3.0
- Created: 2025-03-20T21:15:21.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-11-08T18:06:52.000Z (7 months ago)
- Last Synced: 2025-11-08T19:21:45.675Z (7 months ago)
- Topics: actions
- Language: JavaScript
- Homepage: https://actions.cssnr.com
- Size: 847 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/cssnr/check-build-action/tags)
[](https://github.com/cssnr/check-build-action/releases)
[](https://github.com/cssnr/check-build-action/releases/latest)
[](https://github.com/cssnr/check-build-action/blob/master/src)
[](https://github.com/cssnr/check-build-action/blob/master/action.yml)
[](https://github.com/cssnr/check-build-action/actions/workflows/release.yaml)
[](https://github.com/cssnr/check-build-action/actions/workflows/test.yaml)
[](https://github.com/cssnr/check-build-action/actions/workflows/lint.yaml)
[](https://sonarcloud.io/summary/new_code?id=cssnr_check-build-action)
[](https://github.com/cssnr/check-build-action/pulse)
[](https://codeberg.org/cssnr/check-build-action)
[](https://github.com/cssnr/check-build-action/graphs/contributors)
[](https://github.com/cssnr/check-build-action?tab=readme-ov-file#readme)
[](https://github.com/cssnr/check-build-action)
[](https://github.com/cssnr/check-build-action/discussions)
[](https://github.com/cssnr/check-build-action/forks)
[](https://github.com/cssnr/check-build-action/stargazers)
[](https://cssnr.github.io/)
[](https://discord.gg/wXy6m2X8wY)
[](https://ko-fi.com/cssnr)
# Check Build Action
- [Features](#Features)
- [Inputs](#Inputs)
- [Permissions](#Permissions)
- [Outputs](#Outputs)
- [Examples](#Examples)
- [Tags](#Tags)
- [Support](#Support)
- [Contributing](#Contributing)
Action to Check if the provided Build command was run and Optionally Comment on the PR.
This is useful for things like GitHub Actions which require a built distribution.
It will verify the build command has been run, and optionally comment on the PR with build instructions.
```yaml
- name: 'Check Build Action'
uses: cssnr/check-build-action@v1
with:
build: 'npm run build'
check: 'git diff --quiet dist'
```
_All [inputs](#inputs) are optional._
## Features
- Custom build command
- Custom check command
- Optional path to verify
- Option to comment on PRs
- Option to customize message and mention
- Option to do [anything else you request](https://github.com/cssnr/check-build-action/discussions/categories/feature-requests)...
## Inputs
| Input | Default Value | Description of Input Value |
| :------------------ | :---------------------- | :---------------------------------------- |
| [install](#install) | `npm ci` | Install Command to Run |
| [build](#build) | `npm run build` | Build Command to Run |
| [check](#check) | `git diff --quiet dist` | Check Command to Run |
| [path](#path) | - | Path to Verify Exist |
| [comment](#comment) | `true` | Add Comment to PR |
| [message](#message) | _see below_ | Message for Comment |
| [mention](#mention) | `true` | Mention Actor with @ |
| [summary](#summary) | `true` | Add Workflow Job Summary |
| `token` | `${{ github.token }}` | Only for PAT Use [^1] |
### install
Install command to run, optional. Set empty `install: ""` to disable.
### build
Build or prepare command to run before checking if build was run.
### check
Check command to run to verify build was run. This should exit with error on failure.
### path
A path to verify exists, otherwise will fail.
### comment
Add a comment to the pull request.
### message
Message to put in comment. Default:
```shell
Run: `run npm build`
```
### mention
Will mention the actor in the comment with `@user`.
### summary
Will add result details to the job summary on the workflow run.
👀 View Example Job Summary
---
Coming Soon...
---
```yaml
- name: 'Check Build Action'
uses: cssnr/check-build-action@v1
```
### Permissions
This action requires the following permissions to add pull request comments:
```yaml
permissions:
pull-requests: write
```
Permissions documentation for [Workflows](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token) and [Actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication).
## Outputs
| Output | Output Description |
| :----- | :---------------------- |
| id | Comment ID if Added |
| error | Error Message if Any |
This outputs the changes `json` object and the `markdown` table.
```yaml
- name: 'Check Build Action'
id: outdated
uses: cssnr/check-build-action@v1
- name: 'Echo Output'
env:
ERROR: ${{ steps.outdated.outputs.error }}
run: |
echo "id: ${{ steps.outdated.outputs.id }}"
echo "error: ${ERROR}"
```
Note: due to the way `${{}}` expressions are evaluated, multi-line output gets executed in a run block.
More Output Examples Coming Soon...
## Examples
💡 _Click on an example heading to expand or collapse the example._
Custom Build and Check Command
```yaml
- name: 'Check Build Action'
uses: cssnr/check-build-action@v1
with:
build: 'npm run build'
check: 'git diff --quiet dist'
```
With All Inputs
```yaml
- name: 'Check Build Action'
uses: cssnr/check-build-action@v1
with:
build: 'npm run build'
check: 'git diff --quiet dist'
path: ''
comment: 'true'
message: 'Run: `npm run build`'
mention: 'true'
summary: 'true'
```
For a `pull_request_target` example, see: [check-build.yaml](https://github.com/cssnr/check-build-action/blob/master/.github/workflows/check-build.yaml)
For more examples, you can check out other projects using this action:
https://github.com/cssnr/check-build-action/network/dependents
Want to automatically updated tags on release? Check out: [cssnr/update-version-tags-action](https://github.com/cssnr/update-version-tags-action)
Want to show package changes on release notes? Check out: [cssnr/package-changelog-action](https://github.com/cssnr/package-changelog-action)
Want to check outdated packages on a PR? Check out: [cssnr/npm-outdated-action](https://github.com/cssnr/npm-outdated-action)
## Tags
The following rolling [tags](https://github.com/cssnr/check-build-action/tags) are maintained.
| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | :--: | :---: | :-------: | :------: | :------- |
| [](https://github.com/cssnr/check-build-action/releases/latest) | ✅ | ✅ | ✅ | **Major** | `vN.x.x` | `vN` |
| [](https://github.com/cssnr/check-build-action/releases/latest) | ✅ | ✅ | ❌ | **Minor** | `vN.N.x` | `vN.N` |
| [](https://github.com/cssnr/check-build-action/releases/latest) | ❌ | ❌ | ❌ | **Micro** | `vN.N.N` | `vN.N.N` |
You can view the release notes for each version on the [releases](https://github.com/cssnr/check-build-action/releases) page.
The **Major** tag is recommended. It is the most up-to-date and always backwards compatible.
Breaking changes would result in a **Major** version bump. At a minimum you should use a **Minor** tag.
# Support
For general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/check-build-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/check-build-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/check-build-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=Check%20Build%20Action)
For more information, see the CSSNR [SUPPORT.md](https://github.com/cssnr/.github/blob/master/.github/SUPPORT.md#support).
# Contributing
If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file).
Please consider making a donation to support the development of this project
and [additional](https://cssnr.com/) open source projects.
[](https://ko-fi.com/cssnr)
Additionally, you can support other GitHub Actions I have published:
- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
- [Portainer Stack Deploy Action](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
- [Docker Context Action](https://github.com/cssnr/docker-context-action?tab=readme-ov-file#readme)
- [Actions Up Action](https://github.com/cssnr/actions-up-action?tab=readme-ov-file#readme)
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
- [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme)
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action?tab=readme-ov-file#readme)
- [JSON Key Value Check Action](https://github.com/cssnr/json-key-value-check-action?tab=readme-ov-file#readme)
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action?tab=readme-ov-file#readme)
- [Cloudflare Purge Cache Action](https://github.com/cssnr/cloudflare-purge-cache-action?tab=readme-ov-file#readme)
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
- [Package Changelog Action](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme)
- [NPM Outdated Check Action](https://github.com/cssnr/npm-outdated-action?tab=readme-ov-file#readme)
- [Label Creator Action](https://github.com/cssnr/label-creator-action?tab=readme-ov-file#readme)
- [Algolia Crawler Action](https://github.com/cssnr/algolia-crawler-action?tab=readme-ov-file#readme)
- [Upload Release Action](https://github.com/cssnr/upload-release-action?tab=readme-ov-file#readme)
- [Check Build Action](https://github.com/cssnr/check-build-action?tab=readme-ov-file#readme)
- [Web Request Action](https://github.com/cssnr/web-request-action?tab=readme-ov-file#readme)
- [Get Commit Action](https://github.com/cssnr/get-commit-action?tab=readme-ov-file#readme)
❔ Unpublished Actions
These actions are not published on the Marketplace, but may be useful.
- [cssnr/create-files-action](https://github.com/cssnr/create-files-action?tab=readme-ov-file#readme) - Create various files from templates.
- [cssnr/draft-release-action](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) - Keep a draft release ready to publish.
- [cssnr/env-json-action](https://github.com/cssnr/env-json-action?tab=readme-ov-file#readme) - Convert env file to json or vice versa.
- [cssnr/push-artifacts-action](https://github.com/cssnr/push-artifacts-action?tab=readme-ov-file#readme) - Sync files to a remote host with rsync.
- [smashedr/update-release-notes-action](https://github.com/smashedr/update-release-notes-action?tab=readme-ov-file#readme) - Update release notes.
- [smashedr/combine-release-notes-action](https://github.com/smashedr/combine-release-notes-action?tab=readme-ov-file#readme) - Combine release notes.
---
📝 Template Actions
These are basic action templates that I use for creating new actions.
- [js-test-action](https://github.com/smashedr/js-test-action?tab=readme-ov-file#readme) - JavaScript
- [ts-test-action](https://github.com/smashedr/ts-test-action?tab=readme-ov-file#readme) - TypeScript
- [py-test-action](https://github.com/smashedr/py-test-action?tab=readme-ov-file#readme) - Python (Dockerfile)
- [docker-test-action](https://github.com/smashedr/docker-test-action?tab=readme-ov-file#readme) - Docker (Image)
Note: The `docker-test-action` builds, runs and pushes images to [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
---
For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)
[^1]:
The `${{ github.token }}` / `{{ secrets.GITHUB_TOKEN }}` is automatically passed, there is no need to manually pass these!
This is only available to allow users to pass a different token they have created and defined in their `secrets`.