From 6f3a1890490bf1467ae48673c0ab571b8fe04f8d Mon Sep 17 00:00:00 2001
From: Cole Helbling <cole.helbling@determinate.systems>
Date: Tue, 3 May 2022 10:25:59 -0700
Subject: [PATCH] Don't create PR if running against a PR

Creating a PR against a PR would just lead to a PR per long-lived PR
(e.g. continuous improvements make merging some feature PR not possible,
yet).
---
 action.yml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/action.yml b/action.yml
index 4daf0db..44754a6 100644
--- a/action.yml
+++ b/action.yml
@@ -28,7 +28,9 @@ outputs:
 runs:
   using: "composite"
   steps:
-    - run: $GITHUB_ACTION_PATH/update-flake-lock.sh
+    - name: Run flake.lock update script
+      run: $GITHUB_ACTION_PATH/update-flake-lock.sh
+      if: ${{ github.event_name != 'pull_request' }}
       shell: bash
       env:
         GIT_AUTHOR_NAME: github-actions[bot]
@@ -37,7 +39,9 @@ runs:
         GIT_COMMITTER_EMAIL: <github-actions[bot]@users.noreply.github.com>
         TARGETS: ${{ inputs.inputs }}
         COMMIT_MSG: ${{ inputs.commit-msg }}
-    - run: |
+    - name: Get commit message
+      if: ${{ github.event_name != 'pull_request' }}
+      run: |
         content="$(git log --format=%b -n 1)"
         content="${content//'%'/'%25'}"
         content="${content//$'\n'/'%0A'}"
@@ -46,6 +50,7 @@ runs:
       shell: bash
       id: commit_message
     - name: Create PR
+      if: ${{ github.event_name != 'pull_request' }}
       id: create-pr
       uses: peter-evans/create-pull-request@v3
       with: