From edd33d872b8f9b78254f38a8554bcdc415dcebf5 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 16 Dec 2024 16:13:53 +0100 Subject: [PATCH 01/13] logging some info --- .github/workflows/detect_api_changes.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index add0c46daa..9b0fbb9660 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -35,6 +35,10 @@ jobs: - name: 👾 Define Diff Versions run: | + echo "Repository: ${{ github.repository }}" + echo "Server URL: ${{ github.server_url }}" + echo "Github: ${{ github }}" + NEW="${{ env.source }}~${{ env.githubRepo }}" if [[ '${{ github.head_ref || env.noTargetBranch }}' == release/* ]] then From 5d07369868fb90c66995ac90fde178310fd85dc6 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 16 Dec 2024 16:18:47 +0100 Subject: [PATCH 02/13] logging pullrequest head name --- .github/workflows/detect_api_changes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index 9b0fbb9660..d8919f137d 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -37,6 +37,7 @@ jobs: run: | echo "Repository: ${{ github.repository }}" echo "Server URL: ${{ github.server_url }}" + echo "Full Name: ${{ github.event.pull_request.head.repo.full_name }}" echo "Github: ${{ github }}" NEW="${{ env.source }}~${{ env.githubRepo }}" From ba28a0da19d6ba9d8b22b10f01b3d520a6d79098 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 16 Dec 2024 16:24:13 +0100 Subject: [PATCH 03/13] Using github.event.pull_request.head.repo.full_name --- .github/workflows/detect_api_changes.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index d8919f137d..cf863558b1 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -35,18 +35,13 @@ jobs: - name: 👾 Define Diff Versions run: | - echo "Repository: ${{ github.repository }}" - echo "Server URL: ${{ github.server_url }}" - echo "Full Name: ${{ github.event.pull_request.head.repo.full_name }}" - echo "Github: ${{ github }}" - - NEW="${{ env.source }}~${{ env.githubRepo }}" + NEW="${{ env.source }}~${{ env.headGithubRepo }}" if [[ '${{ github.head_ref || env.noTargetBranch }}' == release/* ]] then LATEST_TAG=$(git describe --tags --abbrev=0) - OLD="$LATEST_TAG~${{ env.githubRepo }}" + OLD="$LATEST_TAG~${{ env.baseGithubRepo }}" else - OLD="${{ env.target }}~${{ env.githubRepo }}" + OLD="${{ env.target }}~${{ env.baseGithubRepo }}" fi # Providing the output to the environment @@ -55,7 +50,8 @@ jobs: env: source: '${{ github.event.inputs.new || github.head_ref }}' target: '${{ github.event.inputs.old || github.event.pull_request.base.ref }}' - githubRepo: '${{github.server_url}}/${{github.repository}}.git' + headGithubRepo: '${{github.server_url}}/${{ github.event.pull_request.head.repo.full_name || github.repository}}.git' + baseGithubRepo: '${{github.server_url}}/${{github.repository}}.git' noTargetBranch: 'no target branch' - name: 🔍 Detect Changes From 93f2610e278cc90b5981bee098e0820c452b094c Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Tue, 17 Dec 2024 12:07:53 +0100 Subject: [PATCH 04/13] Update detect_api_changes.yml --- .github/workflows/detect_api_changes.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index cf863558b1..5718d0abf2 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -36,12 +36,12 @@ jobs: - name: 👾 Define Diff Versions run: | NEW="${{ env.source }}~${{ env.headGithubRepo }}" + OLD="${{ env.target }}~${{ env.baseGithubRepo }}" + if [[ '${{ github.head_ref || env.noTargetBranch }}' == release/* ]] then LATEST_TAG=$(git describe --tags --abbrev=0) - OLD="$LATEST_TAG~${{ env.baseGithubRepo }}" - else - OLD="${{ env.target }}~${{ env.baseGithubRepo }}" + OLD="$LATEST_TAG~${{ env.baseGithubRepo }}" fi # Providing the output to the environment From a5d30fbb7d2e0c24885e19f84ccc336b1369bbde Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 18 Dec 2024 10:26:12 +0100 Subject: [PATCH 05/13] Update detect_api_changes.yml --- .github/workflows/detect_api_changes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index 5718d0abf2..946c733029 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -15,6 +15,7 @@ on: jobs: build: + permissions: write-all runs-on: macos-14 # Apple Silicon Runner steps: From 660c1df6bddf7ceb5a5e2e4c9a283823c5d564d4 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Wed, 18 Dec 2024 15:32:46 +0100 Subject: [PATCH 06/13] 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 946c733029..e0f139f8fc 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -15,7 +15,7 @@ on: jobs: build: - permissions: write-all + permissions: read-all runs-on: macos-14 # Apple Silicon Runner steps: From 41f8ab23abd763754598ffa285c8ffb765f34c16 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 23 Dec 2024 16:00:31 +0100 Subject: [PATCH 07/13] using specific commit --- .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 cf863558b1..7770070122 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -55,7 +55,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes - uses: Adyen/adyen-swift-public-api-diff@0.5.0 + uses: Adyen/adyen-swift-public-api-diff@85da6fad103de1b3c21ed59af0f1be9998f944c7 id: public_api_diff with: platform: "iOS" From d306c6783bb9aabbb46d932503c396b2d0739fd0 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 23 Dec 2024 16:04:28 +0100 Subject: [PATCH 08/13] test output --- .github/workflows/detect_api_changes.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index 7770070122..bcebe9bd97 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -61,3 +61,8 @@ jobs: platform: "iOS" new: ${{ env.NEW_VERSION }} old: ${{ env.OLD_VERSION }} + + - name: Output Github Step Summary + run: | + echo "Step summary incomming:" + cat $GITHUB_STEP_SUMMARY From 1e399c44238648e9461b4a48aa0ae3f20cc4b135 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 23 Dec 2024 16:25:46 +0100 Subject: [PATCH 09/13] Update detect_api_changes.yml --- .github/workflows/detect_api_changes.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index e0f139f8fc..c54909e1b2 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -11,11 +11,13 @@ on: old: description: 'Branch/tag of the old/comparison version' required: true + +permissions: + pull-requests: write + contents: read jobs: - build: - permissions: read-all runs-on: macos-14 # Apple Silicon Runner steps: From 0b1a76dceec3a729d36d422c1064454c6072aedd Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 2 Jan 2025 10:45:50 +0100 Subject: [PATCH 10/13] Disabling check for now --- .github/workflows/detect_api_changes.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index c54909e1b2..364a4a5607 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -11,21 +11,25 @@ on: old: description: 'Branch/tag of the old/comparison version' required: true - -permissions: - pull-requests: write - contents: read jobs: build: runs-on: macos-14 # Apple Silicon Runner - + steps: - uses: actions/checkout@v4 - uses: n1hility/cancel-previous-runs@v3 with: token: ${{ secrets.GITHUB_TOKEN }} + - name: Exit if fork PR + run: | + # Disabling this check from PRs of forked repositories because of insufficient access permissions + if [[ "${{ env.headGithubRepo }}" != "${{ env.baseGithubRepo }}" ]]; then + echo "The head repository is different from the base repository. Exiting..." + exit 0 + fi + - name: Select latest Xcode uses: maxim-lobanov/setup-xcode@v1 with: From fda1dba642e04642f863728cf5cb46eb96aeb8f2 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 2 Jan 2025 11:00:24 +0100 Subject: [PATCH 11/13] Moved the check into the right place --- .github/workflows/detect_api_changes.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index 364a4a5607..a3da1dbc45 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -22,14 +22,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - - name: Exit if fork PR - run: | - # Disabling this check from PRs of forked repositories because of insufficient access permissions - if [[ "${{ env.headGithubRepo }}" != "${{ env.baseGithubRepo }}" ]]; then - echo "The head repository is different from the base repository. Exiting..." - exit 0 - fi - - name: Select latest Xcode uses: maxim-lobanov/setup-xcode@v1 with: @@ -42,6 +34,12 @@ jobs: - name: 👾 Define Diff Versions run: | + # Disabling this check from PRs of forked repositories because of insufficient access permissions + if [[ "${{ env.headGithubRepo }}" != "${{ env.baseGithubRepo }}" ]]; then + echo "The head repository is different from the base repository. Exiting..." + exit 0 + fi + NEW="${{ env.source }}~${{ env.headGithubRepo }}" OLD="${{ env.target }}~${{ env.baseGithubRepo }}" From f3990cdedae759e21f1ad98c50e10a093eec232e Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 2 Jan 2025 13:49:24 +0100 Subject: [PATCH 12/13] Skipping workflow correctly --- .github/workflows/detect_api_changes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index a3da1dbc45..b2e4dd222e 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -37,6 +37,7 @@ jobs: # Disabling this check from PRs of forked repositories because of insufficient access permissions if [[ "${{ env.headGithubRepo }}" != "${{ env.baseGithubRepo }}" ]]; then echo "The head repository is different from the base repository. Exiting..." + echo "skip_workflow=true" >> $GITHUB_ENV exit 0 fi @@ -60,6 +61,7 @@ jobs: noTargetBranch: 'no target branch' - name: 🔍 Detect Changes + if: env.skip_workflow != 'true' uses: Adyen/adyen-swift-public-api-diff@0.5.0 id: public_api_diff with: From 96ef1f3046ac9dac1638926f43a5a34409b66fae Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Thu, 2 Jan 2025 14:41:02 +0100 Subject: [PATCH 13/13] Removed debug code --- .github/workflows/detect_api_changes.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/detect_api_changes.yml b/.github/workflows/detect_api_changes.yml index 8d0aac87f3..b2e4dd222e 100644 --- a/.github/workflows/detect_api_changes.yml +++ b/.github/workflows/detect_api_changes.yml @@ -68,8 +68,3 @@ jobs: platform: "iOS" new: ${{ env.NEW_VERSION }} old: ${{ env.OLD_VERSION }} - - - name: Output Github Step Summary - run: | - echo "Step summary incomming:" - cat $GITHUB_STEP_SUMMARY