From b7b13bbf8087634739e85e92de0216c1051c7343 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 16:30:06 +0100 Subject: [PATCH 01/28] using local action + resolved a warning --- .github/workflows/detect-api-changes.yml | 2 +- .../SwiftPackageFileHelperModule/SwiftPackageFileHelper.swift | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/detect-api-changes.yml b/.github/workflows/detect-api-changes.yml index 0363128..16b1b78 100644 --- a/.github/workflows/detect-api-changes.yml +++ b/.github/workflows/detect-api-changes.yml @@ -56,7 +56,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes - uses: ./ # Uses the action.yml that's at the root of the repository + uses: ${{ github.repository }}@${{ github.ref }} id: public_api_diff with: platform: "macOS" diff --git a/Sources/Shared/Package/SwiftPackageFileHelperModule/SwiftPackageFileHelper.swift b/Sources/Shared/Package/SwiftPackageFileHelperModule/SwiftPackageFileHelper.swift index baaf437..31dc2b3 100644 --- a/Sources/Shared/Package/SwiftPackageFileHelperModule/SwiftPackageFileHelper.swift +++ b/Sources/Shared/Package/SwiftPackageFileHelperModule/SwiftPackageFileHelper.swift @@ -103,7 +103,6 @@ private extension SwiftPackageFileHelper { let result = try loadPackageDescription(projectDirectoryPath: projectDirectoryPath) - let newLine = "\n" let errorTag = "error: " let warningTag = "warning: " From d3c1709dcefa83a43379df21416c05266f320ffd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 16:35:09 +0100 Subject: [PATCH 02/28] Update detect-api-changes.yml --- .github/workflows/detect-api-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detect-api-changes.yml b/.github/workflows/detect-api-changes.yml index 16b1b78..b422ade 100644 --- a/.github/workflows/detect-api-changes.yml +++ b/.github/workflows/detect-api-changes.yml @@ -56,7 +56,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes - uses: ${{ github.repository }}@${{ github.ref }} + uses: Adyen/adyen-swift-public-api-diff@${{ github.ref }} id: public_api_diff with: platform: "macOS" From 90aeabb865630c3e52a5ee38d8323a1fa9ca5b00 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 16:35:54 +0100 Subject: [PATCH 03/28] Update detect-api-changes.yml --- .github/workflows/detect-api-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detect-api-changes.yml b/.github/workflows/detect-api-changes.yml index b422ade..d27c216 100644 --- a/.github/workflows/detect-api-changes.yml +++ b/.github/workflows/detect-api-changes.yml @@ -56,7 +56,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes - uses: Adyen/adyen-swift-public-api-diff@${{ github.ref }} + uses: "Adyen/adyen-swift-public-api-diff@${{ github.ref }}" id: public_api_diff with: platform: "macOS" From d977b7b2c925e69e3274eb7b4f68be94b70f15e0 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 16:39:41 +0100 Subject: [PATCH 04/28] Update detect-api-changes.yml --- .github/workflows/detect-api-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/detect-api-changes.yml b/.github/workflows/detect-api-changes.yml index d27c216..0363128 100644 --- a/.github/workflows/detect-api-changes.yml +++ b/.github/workflows/detect-api-changes.yml @@ -56,7 +56,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes - uses: "Adyen/adyen-swift-public-api-diff@${{ github.ref }}" + uses: ./ # Uses the action.yml that's at the root of the repository id: public_api_diff with: platform: "macOS" From 7c1af1886dd0d7ab2ea8c5f2be8d8ca8b743f7cb Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:03:40 +0100 Subject: [PATCH 05/28] trying caching --- Package.resolved | 4 ++-- action.yml | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Package.resolved b/Package.resolved index d12b253..f1c1bba 100644 --- a/Package.resolved +++ b/Package.resolved @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/SimplyDanny/SwiftLintPlugins", "state" : { - "revision" : "f9731bef175c3eea3a0ca960f1be78fcc2bc7853", - "version" : "0.57.1" + "revision" : "fac0c3d3ac69b15ea5382275dbbd5e583a2e05fa", + "version" : "0.58.0" } } ], diff --git a/action.yml b/action.yml index d24532e..2ed81aa 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,13 @@ runs: - uses: actions/checkout@v4 with: repository: "Adyen/adyen-swift-public-api-diff" - ref: "0.7.0" + #ref: "0.7.0" + - name: Cache Swift Build + uses: actions/cache@v3 + with: + path: | + $(swift build --configuration release --show-bin-path) + key: ${{ runner.os }}-swift-build-${{ github.sha }} - name: "Run Diff" run: | NEW=${{ inputs.new }} @@ -25,7 +31,25 @@ runs: PROJECT_FOLDER=$PWD echo $PROJECT_FOLDER - swift run public-api-diff project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" + # Build the Swift project in release configuration and get the binary path + BINARY_DIR_PATH=$(swift build --configuration release --show-bin-path) + BINARY_PATH="$BINARY_DIR_PATH/public-api-diff" + + # Check if the binary exists + if [ ! -f "$BINARY" ]; then + echo "Binary not found. Building the project..." + swift build --configuration release + # Check if the build was successful + if [ $? -ne 0 ]; then + echo "Build failed" + exit 1 + fi + else + echo "Binary found at $BINARY_PATH" + fi + + # Run the binary $BINARY + $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY From 7ab9532c787c23ffecb1707ed1434911bd3e50ef Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:14:05 +0100 Subject: [PATCH 06/28] fixing some branches --- action.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 2ed81aa..a34fba8 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,8 @@ runs: with: path: | $(swift build --configuration release --show-bin-path) - key: ${{ runner.os }}-swift-build-${{ github.sha }} + key: ${{ runner.os }}-swift-build-6ec5ba25648323a388a756636e7f668b04d9f615 + #key: ${{ runner.os }}-swift-build-${{ github.sha }} - name: "Run Diff" run: | NEW=${{ inputs.new }} @@ -33,22 +34,22 @@ runs: # Build the Swift project in release configuration and get the binary path BINARY_DIR_PATH=$(swift build --configuration release --show-bin-path) - BINARY_PATH="$BINARY_DIR_PATH/public-api-diff" + BINARY_PATH="$BINARY_DIR_PATH/public-api-diff" # Check if the binary exists - if [ ! -f "$BINARY" ]; then - echo "Binary not found. Building the project..." + if [ ! -f "$BINARY_PATH" ]; then + echo "📭 Binary not found. Building the project..." swift build --configuration release # Check if the build was successful if [ $? -ne 0 ]; then echo "Build failed" - exit 1 + exit 1 fi else - echo "Binary found at $BINARY_PATH" + echo "📬 Binary found at $BINARY_PATH" fi - # Run the binary $BINARY + echo "▶️ Running binary at $BINARY_PATH" $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/logs.txt" From f61db122022fa3f32bfcc568653c322921a826e7 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:23:27 +0100 Subject: [PATCH 07/28] fixing some output --- action.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index a34fba8..948620c 100644 --- a/action.yml +++ b/action.yml @@ -38,13 +38,15 @@ runs: # Check if the binary exists if [ ! -f "$BINARY_PATH" ]; then - echo "📭 Binary not found. Building the project..." - swift build --configuration release + + echo "📭 Binary not found at $BINARY_PATH. Building the project..." + swift build --configuration release + # Check if the build was successful - if [ $? -ne 0 ]; then - echo "Build failed" + if [ ! -f "$BINARY_PATH" ]; then + echo "Build failed" exit 1 - fi + fi else echo "📬 Binary found at $BINARY_PATH" fi From a2aa2f8f2f7429244973bd2b5ba955c49d2fd574 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:26:42 +0100 Subject: [PATCH 08/28] maybe like this? --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 948620c..eea6a7f 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,7 @@ runs: uses: actions/cache@v3 with: path: | - $(swift build --configuration release --show-bin-path) + swift build --configuration release --show-bin-path key: ${{ runner.os }}-swift-build-6ec5ba25648323a388a756636e7f668b04d9f615 #key: ${{ runner.os }}-swift-build-${{ github.sha }} - name: "Run Diff" From bca43c542a50dfd4f90a900351e41d4b321f13ff Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:29:52 +0100 Subject: [PATCH 09/28] computing binary path before --- action.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index eea6a7f..cfeb882 100644 --- a/action.yml +++ b/action.yml @@ -17,11 +17,14 @@ runs: with: repository: "Adyen/adyen-swift-public-api-diff" #ref: "0.7.0" + - name: Compute binary path + id: compute-path + run: echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV + - name: Cache Swift Build uses: actions/cache@v3 with: - path: | - swift build --configuration release --show-bin-path + path: ${{ env.BINARY_PATH }} key: ${{ runner.os }}-swift-build-6ec5ba25648323a388a756636e7f668b04d9f615 #key: ${{ runner.os }}-swift-build-${{ github.sha }} - name: "Run Diff" @@ -29,15 +32,13 @@ runs: NEW=${{ inputs.new }} OLD=${{ inputs.old }} PLATFORM=${{ inputs.platform }} + BINARY_PATH=${{ env.BINARY_PATH }} PROJECT_FOLDER=$PWD - echo $PROJECT_FOLDER - # Build the Swift project in release configuration and get the binary path - BINARY_DIR_PATH=$(swift build --configuration release --show-bin-path) - BINARY_PATH="$BINARY_DIR_PATH/public-api-diff" + echo $PROJECT_FOLDER # Check if the binary exists - if [ ! -f "$BINARY_PATH" ]; then + if [ ! -f $BINARY_PATH ]; then echo "📭 Binary not found at $BINARY_PATH. Building the project..." swift build --configuration release From ff0245713f069d6d2bb1e5f7a5d322b14c786562 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:31:38 +0100 Subject: [PATCH 10/28] adding shell --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index cfeb882..862850a 100644 --- a/action.yml +++ b/action.yml @@ -20,7 +20,8 @@ runs: - name: Compute binary path id: compute-path run: echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV - + shell: bash + - name: Cache Swift Build uses: actions/cache@v3 with: From 287ad5c484ca8a635c8430d00c35f711ee22a897 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:53:47 +0100 Subject: [PATCH 11/28] Using individual cache actions --- action.yml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/action.yml b/action.yml index 862850a..37090fc 100644 --- a/action.yml +++ b/action.yml @@ -17,18 +17,28 @@ runs: with: repository: "Adyen/adyen-swift-public-api-diff" #ref: "0.7.0" - - name: Compute binary path + + - name: 👾 Compute binary path id: compute-path run: echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV shell: bash - - - name: Cache Swift Build - uses: actions/cache@v3 + + - name: 🛻 Restore Binary + uses: actions/cache/restore@v3 + with: + path: ${{ env.BINARY_PATH }} + key: build-cache-${{ runner.os }}-ENTER_VERSION_NUMBER_HERE + + - name: 🧰 Build Swift CLI + run: swift build --configuration release + + - name: 💾 Save Binary + uses: actions/cache/save@v3 with: path: ${{ env.BINARY_PATH }} - key: ${{ runner.os }}-swift-build-6ec5ba25648323a388a756636e7f668b04d9f615 - #key: ${{ runner.os }}-swift-build-${{ github.sha }} - - name: "Run Diff" + key: build-cache-${{ runner.os }}-ENTER_VERSION_NUMBER_HERE + + - name: 🏃 Run Diff run: | NEW=${{ inputs.new }} OLD=${{ inputs.old }} @@ -40,15 +50,7 @@ runs: # Check if the binary exists if [ ! -f $BINARY_PATH ]; then - - echo "📭 Binary not found at $BINARY_PATH. Building the project..." - swift build --configuration release - - # Check if the build was successful - if [ ! -f "$BINARY_PATH" ]; then - echo "Build failed" - exit 1 - fi + echo "📭 Binary not found at $BINARY_PATH. Exiting..." else echo "📬 Binary found at $BINARY_PATH" fi From 53d34aea22e59236ccf625dc8a54d292a55fa0cb Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 17:54:40 +0100 Subject: [PATCH 12/28] adding shell --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 37090fc..afbd8f5 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,7 @@ runs: - name: 🧰 Build Swift CLI run: swift build --configuration release + shell: bash - name: 💾 Save Binary uses: actions/cache/save@v3 From cb7edfaa310679fe590ec6b23059d7754ef4602f Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 18:05:14 +0100 Subject: [PATCH 13/28] only build binary if it could not be restored from cache --- action.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index afbd8f5..4d621cc 100644 --- a/action.yml +++ b/action.yml @@ -24,16 +24,28 @@ runs: shell: bash - name: 🛻 Restore Binary + id: cache-restore uses: actions/cache/restore@v3 with: path: ${{ env.BINARY_PATH }} key: build-cache-${{ runner.os }}-ENTER_VERSION_NUMBER_HERE - name: 🧰 Build Swift CLI + if: steps.cache-restore.outputs.cache-hit != 'true' run: swift build --configuration release shell: bash + - name: 🪪 Verify binary exists + run: | + if [ ! -f ${{ env.BINARY_PATH }} ]; then + echo "Binary not found at ${{ env.BINARY_PATH }} after build" + exit 1 + else + echo "Binary found at ${{ env.BINARY_PATH }}" + fi + - name: 💾 Save Binary + if: steps.cache-restore.outputs.cache-hit != 'true' uses: actions/cache/save@v3 with: path: ${{ env.BINARY_PATH }} @@ -49,13 +61,6 @@ runs: echo $PROJECT_FOLDER - # Check if the binary exists - if [ ! -f $BINARY_PATH ]; then - echo "📭 Binary not found at $BINARY_PATH. Exiting..." - else - echo "📬 Binary found at $BINARY_PATH" - fi - echo "▶️ Running binary at $BINARY_PATH" $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/logs.txt" From 2ad989ab62e749cb0500ab976fb4417ecbd3653a Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 15 Jan 2025 18:06:30 +0100 Subject: [PATCH 14/28] added shell --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 4d621cc..3ae824f 100644 --- a/action.yml +++ b/action.yml @@ -43,6 +43,7 @@ runs: else echo "Binary found at ${{ env.BINARY_PATH }}" fi + shell: bash - name: 💾 Save Binary if: steps.cache-restore.outputs.cache-hit != 'true' From b4808bd89b0bcc904de44d60eb35fd0a0c6c75b0 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:22:46 +0100 Subject: [PATCH 15/28] Update action.yml --- action.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 3ae824f..2079eff 100644 --- a/action.yml +++ b/action.yml @@ -10,13 +10,19 @@ inputs: old: description: 'Specify the old version to compare to' required: true + +env: + VERSION_NUMBER: "0.7.0" + HEAD_GITHUB_REPO: '${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git' + BASE_GITHUB_REPO: '${{github.server_url}}/${{github.repository}}.git' + runs: using: 'composite' steps: - uses: actions/checkout@v4 with: repository: "Adyen/adyen-swift-public-api-diff" - #ref: "0.7.0" + # ref: ${{ env.VERSION_NUMBER }} - name: 👾 Compute binary path id: compute-path @@ -28,7 +34,7 @@ runs: uses: actions/cache/restore@v3 with: path: ${{ env.BINARY_PATH }} - key: build-cache-${{ runner.os }}-ENTER_VERSION_NUMBER_HERE + key: build-cache-${{ runner.os }}-${{ env.VERSION_NUMBER }} - name: 🧰 Build Swift CLI if: steps.cache-restore.outputs.cache-hit != 'true' @@ -50,7 +56,7 @@ runs: uses: actions/cache/save@v3 with: path: ${{ env.BINARY_PATH }} - key: build-cache-${{ runner.os }}-ENTER_VERSION_NUMBER_HERE + key: build-cache-${{ runner.os }}-${{ env.VERSION_NUMBER }} - name: 🏃 Run Diff run: | @@ -60,8 +66,6 @@ runs: BINARY_PATH=${{ env.BINARY_PATH }} PROJECT_FOLDER=$PWD - echo $PROJECT_FOLDER - echo "▶️ Running binary at $BINARY_PATH" $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/logs.txt" From b3c51b9d0b8df5ea9b8fe1b36edc55c4d0075d3c Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:27:07 +0100 Subject: [PATCH 16/28] Update action.yml --- action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2079eff..a6896d0 100644 --- a/action.yml +++ b/action.yml @@ -72,8 +72,11 @@ runs: cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY shell: bash - - - if: ${{ github.event.pull_request.base.ref != '' }} + + # We only want to comment if we're in a Pull Request and if the Pull Request is not from a forked Repository + # Forked Repositories have different rights for security reasons and thus it's not possible to comment on PRs without lowering the security + # once the tool is merged the base repo rights apply and the script can comment on PRs as expected. + - if: ${{ github.event.pull_request.base.ref != '' && env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} name: 📝 Comment on PR uses: thollander/actions-comment-pull-request@v3 with: From be08c0853dd25ec9081df536a8e56e987a23595b Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:31:20 +0100 Subject: [PATCH 17/28] Update action.yml --- action.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index a6896d0..e9cd4fd 100644 --- a/action.yml +++ b/action.yml @@ -13,8 +13,6 @@ inputs: env: VERSION_NUMBER: "0.7.0" - HEAD_GITHUB_REPO: '${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git' - BASE_GITHUB_REPO: '${{github.server_url}}/${{github.repository}}.git' runs: using: 'composite' @@ -24,9 +22,12 @@ runs: repository: "Adyen/adyen-swift-public-api-diff" # ref: ${{ env.VERSION_NUMBER }} - - name: 👾 Compute binary path + - name: 👾 Compute prerequisites id: compute-path - run: echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV + run: | + echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV + echo "HEAD_GITHUB_REPO=${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git" >> $GITHUB_ENV + echo "BASE_GITHUB_REPO=${{github.server_url}}/${{github.repository}}.git" >> $GITHUB_ENV shell: bash - name: 🛻 Restore Binary From 3ab505665cdbc4febf9fcd961027d038609231f5 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:40:49 +0100 Subject: [PATCH 18/28] Update action.yml --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index e9cd4fd..9559f9b 100644 --- a/action.yml +++ b/action.yml @@ -84,6 +84,12 @@ runs: file-path: "${{ github.workspace }}/api_comparison.md" comment-tag: api_changes mode: recreate + + # Change to != - just for testing for now + - if: ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} + name: ⚠️ Warning: PR from forked repository + run: echo "::warning::This PR is from a forked repository. Commenting on PRs from forks is disabled for access right reasons." >> $GITHUB_STEP_SUMMARY + shell: bash From 6d718342850d4ebe81dbd3bb9fa00acbd9ccb8ec Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:42:45 +0100 Subject: [PATCH 19/28] Update action.yml --- action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 9559f9b..b3d6953 100644 --- a/action.yml +++ b/action.yml @@ -87,8 +87,9 @@ runs: # Change to != - just for testing for now - if: ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} - name: ⚠️ Warning: PR from forked repository - run: echo "::warning::This PR is from a forked repository. Commenting on PRs from forks is disabled for access right reasons." >> $GITHUB_STEP_SUMMARY + name: 💬 PR from forked repository info + run: | + echo "::warning::This PR is from a forked repository. Commenting on PRs from forks is disabled for access right reasons." >> $GITHUB_STEP_SUMMARY shell: bash From a9332e6fd42b0ccc8db0eb15c486db9e8278bd41 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 14:55:51 +0100 Subject: [PATCH 20/28] Update action.yml --- action.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index b3d6953..9ce494d 100644 --- a/action.yml +++ b/action.yml @@ -70,6 +70,13 @@ runs: echo "▶️ Running binary at $BINARY_PATH" $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" cat "$PROJECT_FOLDER/logs.txt" + + # fix the equation check, should be != + if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then + echo > [!IMPORTANT] >> $GITHUB_STEP_SUMMARY + echo > This PR is from a forked repository. Commenting on PRs from forks is disabled due to insufficient access rights. >> $GITHUB_STEP_SUMMARY + echo --- >> $GITHUB_STEP_SUMMARY + fi cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY shell: bash @@ -84,13 +91,3 @@ runs: file-path: "${{ github.workspace }}/api_comparison.md" comment-tag: api_changes mode: recreate - - # Change to != - just for testing for now - - if: ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} - name: 💬 PR from forked repository info - run: | - echo "::warning::This PR is from a forked repository. Commenting on PRs from forks is disabled for access right reasons." >> $GITHUB_STEP_SUMMARY - shell: bash - - - From 5d172214a6df84fa163693e99cde0472154c4765 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:02:26 +0100 Subject: [PATCH 21/28] Update action.yml --- action.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 9ce494d..f0d3ce3 100644 --- a/action.yml +++ b/action.yml @@ -10,12 +10,11 @@ inputs: old: description: 'Specify the old version to compare to' required: true - -env: - VERSION_NUMBER: "0.7.0" runs: using: 'composite' + env: + VERSION_NUMBER: "0.7.0" steps: - uses: actions/checkout@v4 with: @@ -25,6 +24,7 @@ runs: - name: 👾 Compute prerequisites id: compute-path run: | + echo "public-api-diff version: ${{ env.VERSION_NUMBER }}" echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV echo "HEAD_GITHUB_REPO=${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git" >> $GITHUB_ENV echo "BASE_GITHUB_REPO=${{github.server_url}}/${{github.repository}}.git" >> $GITHUB_ENV @@ -73,9 +73,11 @@ runs: # fix the equation check, should be != if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then - echo > [!IMPORTANT] >> $GITHUB_STEP_SUMMARY - echo > This PR is from a forked repository. Commenting on PRs from forks is disabled due to insufficient access rights. >> $GITHUB_STEP_SUMMARY - echo --- >> $GITHUB_STEP_SUMMARY + echo "Adding forked PR info to step summary" + + echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY + echo "> This PR is from a forked repository. Commenting on PRs from forks is disabled due to insufficient access rights." >> $GITHUB_STEP_SUMMARY + echo "---" >> $GITHUB_STEP_SUMMARY fi cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY From b82e5a7b7d5c432c248edc4c29914ad61650dabd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:05:28 +0100 Subject: [PATCH 22/28] Update action.yml --- action.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index f0d3ce3..0585239 100644 --- a/action.yml +++ b/action.yml @@ -13,22 +13,19 @@ inputs: runs: using: 'composite' - env: - VERSION_NUMBER: "0.7.0" steps: - - uses: actions/checkout@v4 - with: - repository: "Adyen/adyen-swift-public-api-diff" - # ref: ${{ env.VERSION_NUMBER }} - - - name: 👾 Compute prerequisites - id: compute-path + - name: 🍱 Compute prerequisites run: | - echo "public-api-diff version: ${{ env.VERSION_NUMBER }}" + echo "VERSION_NUMBER=0.7.0" >> $GITHUB_ENV echo "BINARY_PATH=$(swift build --configuration release --show-bin-path)/public-api-diff" >> $GITHUB_ENV echo "HEAD_GITHUB_REPO=${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git" >> $GITHUB_ENV echo "BASE_GITHUB_REPO=${{github.server_url}}/${{github.repository}}.git" >> $GITHUB_ENV shell: bash + + - uses: actions/checkout@v4 + with: + repository: "Adyen/adyen-swift-public-api-diff" + # ref: ${{ env.VERSION_NUMBER }} - name: 🛻 Restore Binary id: cache-restore From 1ab2814d5bf541689049f1e33de35240f4b18d11 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:28:31 +0100 Subject: [PATCH 23/28] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0585239..b93c6d3 100644 --- a/action.yml +++ b/action.yml @@ -66,7 +66,7 @@ runs: echo "▶️ Running binary at $BINARY_PATH" $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" - cat "$PROJECT_FOLDER/logs.txt" + # cat "$PROJECT_FOLDER/logs.txt" # fix the equation check, should be != if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then From 92713255ff5b923be51edc987dc480bd51809539 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:34:19 +0100 Subject: [PATCH 24/28] Update action.yml --- action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index b93c6d3..dd8aa3d 100644 --- a/action.yml +++ b/action.yml @@ -68,14 +68,16 @@ runs: $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" # cat "$PROJECT_FOLDER/logs.txt" + echo ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} + # fix the equation check, should be != - if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then + # if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then echo "Adding forked PR info to step summary" echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY echo "> This PR is from a forked repository. Commenting on PRs from forks is disabled due to insufficient access rights." >> $GITHUB_STEP_SUMMARY echo "---" >> $GITHUB_STEP_SUMMARY - fi + # fi cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY shell: bash From 2a74cb35d4b6bfe9df9a47888b686946f45ac626 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:42:58 +0100 Subject: [PATCH 25/28] Update action.yml --- action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yml b/action.yml index dd8aa3d..b19520e 100644 --- a/action.yml +++ b/action.yml @@ -68,10 +68,8 @@ runs: $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" # cat "$PROJECT_FOLDER/logs.txt" - echo ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} - # fix the equation check, should be != - # if [[ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO ]]; then + # if [[ ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} ]]; then echo "Adding forked PR info to step summary" echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY From e1a232fcd20b93f5915c29fd280e16adf56654a1 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:49:58 +0100 Subject: [PATCH 26/28] Update action.yml --- action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index b19520e..7d3d038 100644 --- a/action.yml +++ b/action.yml @@ -70,10 +70,11 @@ runs: # fix the equation check, should be != # if [[ ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} ]]; then - echo "Adding forked PR info to step summary" - + echo "---" >> $GITHUB_STEP_SUMMARY echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY - echo "> This PR is from a forked repository. Commenting on PRs from forks is disabled due to insufficient access rights." >> $GITHUB_STEP_SUMMARY + echo "> This PR is from a forked repository" >> $GITHUB_STEP_SUMMARY + echo "> Commenting on PRs from forks is unavailable due to insufficient access rights." >> $GITHUB_STEP_SUMMARY + echo "> Once merged, the output will be posted as a auto-updating comment under the pull request." >> $GITHUB_STEP_SUMMARY echo "---" >> $GITHUB_STEP_SUMMARY # fi From ca20221179b270bd570487389627f59e1ac764cd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 15:55:25 +0100 Subject: [PATCH 27/28] Update action.yml --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 7d3d038..a1de15a 100644 --- a/action.yml +++ b/action.yml @@ -68,12 +68,11 @@ runs: $BINARY_PATH project --new "$NEW" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-output "$PROJECT_FOLDER/logs.txt" # cat "$PROJECT_FOLDER/logs.txt" - # fix the equation check, should be != - # if [[ ${{ env.HEAD_GITHUB_REPO == env.BASE_GITHUB_REPO }} ]]; then + # if [[ ${{ env.HEAD_GITHUB_REPO != env.BASE_GITHUB_REPO }} ]]; then echo "---" >> $GITHUB_STEP_SUMMARY echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY echo "> This PR is from a forked repository" >> $GITHUB_STEP_SUMMARY - echo "> Commenting on PRs from forks is unavailable due to insufficient access rights." >> $GITHUB_STEP_SUMMARY + echo "> Due to insufficient rights, **commenting on pull requests from forks is not possible**." >> $GITHUB_STEP_SUMMARY echo "> Once merged, the output will be posted as a auto-updating comment under the pull request." >> $GITHUB_STEP_SUMMARY echo "---" >> $GITHUB_STEP_SUMMARY # fi From 6a6b72d9033639ec9ca2b86656f6b6acdc74e96d Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Sat, 18 Jan 2025 16:00:15 +0100 Subject: [PATCH 28/28] Update action.yml --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index a1de15a..ddb7039 100644 --- a/action.yml +++ b/action.yml @@ -72,8 +72,8 @@ runs: echo "---" >> $GITHUB_STEP_SUMMARY echo "> [!IMPORTANT]" >> $GITHUB_STEP_SUMMARY echo "> This PR is from a forked repository" >> $GITHUB_STEP_SUMMARY - echo "> Due to insufficient rights, **commenting on pull requests from forks is not possible**." >> $GITHUB_STEP_SUMMARY - echo "> Once merged, the output will be posted as a auto-updating comment under the pull request." >> $GITHUB_STEP_SUMMARY + echo "> **Commenting on pull requests from forks is not possible** due to insufficient permissions." >> $GITHUB_STEP_SUMMARY + echo "> Once merged, the output will be posted as an auto-updating comment under the pull request." >> $GITHUB_STEP_SUMMARY echo "---" >> $GITHUB_STEP_SUMMARY # fi