diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 29b5a1f..41a2df7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -70,6 +70,15 @@ jobs:
];
+ const pullRequest = context.payload.pull_request;
+
+
+ if (!pullRequest) {
+ console.log('No pull request context available.');
+ return;
+ }
+
+
const title = context.payload.pull_request.title;
const existingLabels = context.payload.pull_request.labels.map(label => label.name);
diff --git a/ADotNet/ADotNet.csproj b/ADotNet/ADotNet.csproj
index a96d04b..496fb8b 100644
--- a/ADotNet/ADotNet.csproj
+++ b/ADotNet/ADotNet.csproj
@@ -14,7 +14,7 @@
git
ADO YAML AzureDevOps
- This release has a new label job component that can be used to automatically label pull requests based on the pull request title.
+ This release has a minor fix for the label job component. The label job component now only applies to pull requests.
True
README.md
diff --git a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/LabelJob.cs b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/LabelJob.cs
index 6040eb4..85569cf 100644
--- a/ADotNet/Models/Pipelines/GithubPipelines/DotNets/LabelJob.cs
+++ b/ADotNet/Models/Pipelines/GithubPipelines/DotNets/LabelJob.cs
@@ -62,6 +62,13 @@ public LabelJob(
'BUSINESS:'
];
+const pullRequest = context.payload.pull_request;
+
+if (!pullRequest) {
+ console.log('No pull request context available.');
+ return;
+}
+
const title = context.payload.pull_request.title;
const existingLabels = context.payload.pull_request.labels.map(label => label.name);