Skip to content

Commit 65b96c3

Browse files
scholarsmatehdalsania
authored andcommitted
fix: PR checkbox validation logic in workflow
Updated conditional check for pull request event and improved optional chaining for pull request body.
1 parent 5203884 commit 65b96c3

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

.github/workflows/documentaion.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
name: Enforce Documentation Checkbox
1818

1919
on:
20-
push:
21-
branches-ignore:
22-
- "main"
23-
- "dependabot/**" # dependabot branches
24-
- "update/**" # scala-steward branches
2520
pull_request:
2621
types: [opened, edited, synchronize, reopened]
2722
branches-ignore:
@@ -30,20 +25,19 @@ on:
3025

3126
jobs:
3227
enforce-checkbox:
33-
# this if is to further ensure that this job won't run on dependabot or scala-steward PRs
3428
if: ${{ !startsWith(github.head_ref, 'dependabot/') && !startsWith(github.head_ref, 'update/') }}
3529
runs-on: ubuntu-22.04
3630
steps:
3731
- name: Check required confirmation checkbox
3832
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v7
3933
with:
4034
script: |
41-
const prBody = context.payload.pull_request.body || "";
35+
const prBody = context.payload.pull_request?.body || "";
4236
const checkbox1Text = "- [x] I have determined that no documentation updates are needed for these changes";
4337
const checkbox2Text = "- [x] I have added the following documentation for these changes";
44-
38+
4539
if (!prBody.includes(checkbox1Text) && !prBody.includes(checkbox2Text)) {
46-
core.setFailed("❌ Required documentation checkbox not checked. Please check one of the the box before merging.");
40+
core.setFailed("❌ Required documentation checkbox not checked. Please check one of the boxes before merging.");
4741
} else {
4842
core.info("✅ Required documentation checkbox is checked.");
4943
}

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
1919
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.7")
20-
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.5")
20+
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.3")
2121
addSbtPlugin("org.musigma" % "sbt-rat" % "0.7.0")
2222
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.6")
2323
addSbtPlugin("org.scala-sbt.plugins" % "sbt-xjc" % "0.10")

0 commit comments

Comments
 (0)