Skip to content

Commit

Permalink
Validate PR changes to make sure there are no changes missing (#165)
Browse files Browse the repository at this point in the history
* Create pr-check.yml

* Use correct npm commands

* Adress issues from linting

* CI step to fill the node_modules needed for the compile

* Fix check

* Add message when things are good
  • Loading branch information
rajbos committed Dec 12, 2023
1 parent 46bc818 commit 0c5f57c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# check incoming pr's and make sure that
# - the code builds
# - the dist folder does not need updating
name: PR Check

on:
push:

pull_request:

jobs:
build-and-check-dist:
name: Run build and check dist folder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '20'

- name: Compile with NPM
run: |
npm ci
npm run compile
npm run package
- name: Check if there are changes that where not in the commit
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Found changes to commit after building. Here is the output from `git status`:"
git status
exit 1
else
echo "No changes found after compiling. PR is good for a review."
fi
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35066,7 +35066,7 @@ async function getPrFilesWithBlobSize(pullRequestNumber) {
: data;
const prFilesWithBlobSize = await Promise.all(files
// Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) or without blob_url (e.g. submodules)
.filter(file => file.sha != null && file.blob_url != null)
.filter(file => file.sha !== null && file.blob_url !== null)
.map(async (file) => {
const { filename, sha, patch } = file;
const { data: blob } = await octokit.rest.git.getBlob({
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ async function getPrFilesWithBlobSize(pullRequestNumber: number) {
const prFilesWithBlobSize = await Promise.all(
files
// Cannot get blobs for files without sha (e.g. happens when only changing a permission bit on the file) or without blob_url (e.g. submodules)
.filter(file => file.sha != null && file.blob_url != null)
.filter(file => file.sha !== null && file.blob_url !== null)
.map(async file => {
const {filename, sha, patch} = file;
const {data: blob} = await octokit.rest.git.getBlob({
Expand Down

0 comments on commit 0c5f57c

Please sign in to comment.