Add additional validation
diff --git a/dist/index.js b/dist/index.js
index 88b1aee..3995113 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1472,14 +1472,24 @@
             const token = core.getInput('token');
             const selfRunId = getRequiredEnv('GITHUB_RUN_ID');
             const repository = getRequiredEnv('GITHUB_REPOSITORY');
+            const eventName = getRequiredEnv('GITHUB_EVENT_NAME');
             const [owner, repo] = repository.split('/');
-            const refsPrefix = 'refs/heads/';
+            const branchPrefix = 'refs/heads/';
+            const tagPrefix = 'refs/tags/';
+            if (eventName !== 'push') {
+                core.info('Skipping non-push event');
+                return;
+            }
             let branch = getRequiredEnv('GITHUB_REF');
-            if (!branch.startsWith(refsPrefix)) {
+            if (!branch.startsWith(branchPrefix)) {
+                if (branch.startsWith(tagPrefix)) {
+                    core.info(`Skipping tag build`);
+                    return;
+                }
                 const message = `${branch} was not an expected branch ref (refs/heads/).`;
                 throw new Error(message);
             }
-            branch = branch.replace(refsPrefix, '');
+            branch = branch.replace(branchPrefix, '');
             core.info(`Branch is ${branch}, repo is ${repo}, and owner is ${owner}, and id is ${selfRunId}`);
             const octokit = new github.GitHub(token);
             const listRuns = octokit.actions.listRepoWorkflowRuns.endpoint.merge({
diff --git a/src/main.ts b/src/main.ts
index 44db6fe..bfe9c55 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -7,15 +7,27 @@
 
     const selfRunId = getRequiredEnv('GITHUB_RUN_ID')
     const repository = getRequiredEnv('GITHUB_REPOSITORY')
+    const eventName = getRequiredEnv('GITHUB_EVENT_NAME')
+
     const [owner, repo] = repository.split('/')
-    const refsPrefix = 'refs/heads/'
+    const branchPrefix = 'refs/heads/'
+    const tagPrefix = 'refs/tags/'
+
+    if (eventName !== 'push') {
+      core.info('Skipping non-push event')
+      return
+    }
 
     let branch = getRequiredEnv('GITHUB_REF')
-    if (!branch.startsWith(refsPrefix)) {
+    if (!branch.startsWith(branchPrefix)) {
+      if (branch.startsWith(tagPrefix)) {
+        core.info(`Skipping tag build`)
+        return
+      }
       const message = `${branch} was not an expected branch ref (refs/heads/).`
       throw new Error(message)
     }
-    branch = branch.replace(refsPrefix, '')
+    branch = branch.replace(branchPrefix, '')
 
     core.info(
       `Branch is ${branch}, repo is ${repo}, and owner is ${owner}, and id is ${selfRunId}`