@@ -18,10 +18,10 @@ jobs:
1818 - name : Checkout repository
1919 uses : actions/checkout@v4
2020
21- - name : Set up JDK 24
21+ - name : Set up JDK 25
2222 uses : actions/setup-java@v4
2323 with :
24- java-version : ' 24 '
24+ java-version : ' 25 '
2525 distribution : ' temurin'
2626
2727 - name : Cache Maven dependencies
@@ -35,29 +35,68 @@ jobs:
3535 run : mvn clean install
3636
3737 - name : Run API Tracker
38+ id : tracker
3839 run : |
3940 mvn exec:java \
4041 -pl json-java21-api-tracker \
4142 -Dexec.mainClass="io.github.simbo1905.tracker.ApiTrackerRunner" \
4243 -Dexec.args="INFO" \
4344 -Djava.util.logging.ConsoleHandler.level=INFO
44-
45- - name : Create issue if differences found
46- if : failure()
47- uses : actions/github-script@v7
45+
46+ # Read outputs into environment
47+ echo "fingerprint=$(cat target/api-tracker/fingerprint.txt)" >> $GITHUB_OUTPUT
48+ echo "has_differences=$(cat target/api-tracker/has-differences.txt)" >> $GITHUB_OUTPUT
49+
50+ - name : Upload API report artifact
51+ uses : actions/upload-artifact@v4
4852 with :
49- script : |
50- const title = 'API differences detected between local and upstream';
51- const body = `The daily API tracker found differences between our local implementation and upstream.
52-
53- Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
54-
55- Date: ${new Date().toISOString().split('T')[0]}`;
56-
57- github.rest.issues.create({
58- owner: context.repo.owner,
59- repo: context.repo.repo,
60- title: title,
61- body: body,
62- labels: ['api-tracking', 'upstream-sync']
63- });
53+ name : api-tracker-report
54+ path : target/api-tracker/
55+ retention-days : 90
56+
57+ - name : Check for existing issue
58+ if : steps.tracker.outputs.has_differences == 'true'
59+ id : check_issue
60+ env :
61+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62+ run : |
63+ FINGERPRINT="${{ steps.tracker.outputs.fingerprint }}"
64+ echo "Looking for existing issue with hash:${FINGERPRINT}"
65+
66+ # Search for open issues with this fingerprint
67+ EXISTING=$(gh issue list --state open --search "hash:${FINGERPRINT} in:title" --json number --jq '.[0].number // empty')
68+
69+ if [ -n "$EXISTING" ]; then
70+ echo "Found existing issue #${EXISTING}"
71+ echo "issue_exists=true" >> $GITHUB_OUTPUT
72+ echo "existing_issue=${EXISTING}" >> $GITHUB_OUTPUT
73+ else
74+ echo "No existing issue found"
75+ echo "issue_exists=false" >> $GITHUB_OUTPUT
76+ fi
77+
78+ - name : Create issue for API differences
79+ if : steps.tracker.outputs.has_differences == 'true' && steps.check_issue.outputs.issue_exists == 'false'
80+ env :
81+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82+ run : |
83+ FINGERPRINT="${{ steps.tracker.outputs.fingerprint }}"
84+ SUMMARY=$(cat target/api-tracker/summary.md)
85+
86+ # Create issue body
87+ cat > /tmp/issue_body.md << EOF
88+ ${SUMMARY}
89+
90+ ## Details
91+
92+ - **Fingerprint**: \`hash:${FINGERPRINT}\`
93+ - **Workflow Run**: [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
94+ - **Artifact**: Download the full JSON report from the workflow artifacts
95+
96+ This issue was auto-generated by the Daily API Tracker workflow.
97+ EOF
98+
99+ gh issue create \
100+ --title "API drift detected [hash:${FINGERPRINT}]" \
101+ --body-file /tmp/issue_body.md \
102+ --label "api-tracking,upstream-sync"
0 commit comments