Skip to content

Commit 2c57186

Browse files
committed
Adding initial Action
1 parent 16f7ffd commit 2c57186

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

.github/workflows/detect-api.changes.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ jobs:
3333
with:
3434
fetch-depth: 0
3535

36-
- name: 🔍 Detect Changes
36+
- name: 👾 Define Diff Versions
3737
run: |
38-
PROJECT_FOLDER=$PWD
39-
echo $PROJECT_FOLDER
40-
4138
NEW="${{ env.source }}~${{ env.githubRepo }}"
4239
if [[ '${{ github.head_ref || env.noTargetBranch }}' == 'release/*' ]]
4340
then
@@ -47,14 +44,25 @@ jobs:
4744
OLD="${{ env.target }}~${{ env.githubRepo }}"
4845
fi
4946
50-
swift run public-api-diff project --new "$NEW" --old "$OLD" --platform macos --output "$PROJECT_FOLDER/api_comparison.md" --log-level debug --log-output "$PROJECT_FOLDER/logs.txt"
51-
cat "$PROJECT_FOLDER/logs.txt"
52-
cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY
47+
echo "OLD=$OLD" >> $GITHUB_OUTPUT
48+
echo "NEW=$NEW" >> $GITHUB_OUTPUT
5349
env:
5450
source: '${{ github.event.inputs.new || github.head_ref }}'
5551
target: '${{ github.event.inputs.old || github.event.pull_request.base.ref }}'
5652
githubRepo: '${{github.server_url}}/${{github.repository}}.git'
5753
noTargetBranch: 'no target branch'
54+
55+
- name: 🔍 Detect Changes
56+
run: |
57+
echo "OUTPUTS: ${{ env.steps.vars.outputs }}"
58+
echo "NEW: ${{ env.steps.vars.outputs.NEW }}"
59+
echo "OLD: ${{ env.steps.vars.outputs.OLD }}"
60+
61+
PROJECT_FOLDER=$PWD
62+
echo $PROJECT_FOLDER
63+
swift run public-api-diff project --new "$NEW" --old "$OLD" --platform macos --output "$PROJECT_FOLDER/api_comparison.md" --log-level debug --log-output "$PROJECT_FOLDER/logs.txt"
64+
cat "$PROJECT_FOLDER/logs.txt"
65+
cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_STEP_SUMMARY
5866
5967
- if: ${{ github.event.pull_request.base.ref != '' }}
6068
name: 📝 Comment on PR

action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Swift Public API Diff'
2+
description: 'Diff 2 versions of your Swift SDK'
3+
inputs:
4+
platform:
5+
description: 'The platform to build the project for (iOS/macOS)'
6+
required: true
7+
new:
8+
description: 'Specify the updated version to compare to'
9+
required: true
10+
old:
11+
description: 'Specify the old version to compare to'
12+
required: true
13+
outputs:
14+
markdown:
15+
description: 'The generated markdown output'
16+
runs:
17+
using: 'macos-14'
18+
steps:
19+
- name: "Run Diff"
20+
run: |
21+
PROJECT_FOLDER=$PWD
22+
echo $PROJECT_FOLDER
23+
swift run public-api-diff project --new "${NEW}" --old "$OLD" --platform "$PLATFORM" --output "$PROJECT_FOLDER/api_comparison.md" --log-level debug --log-output "$PROJECT_FOLDER/logs.txt"
24+
cat "$PROJECT_FOLDER/logs.txt"
25+
cat "$PROJECT_FOLDER/api_comparison.md" >> $GITHUB_OUTPUT
26+
shell: bash
27+
env:
28+
NEW=${{ github.event.inputs.new }}
29+
OLD=${{ github.event.inputs.old }}
30+
PLATFORM=${{ github.event.inputs.platform }}

0 commit comments

Comments
 (0)