@@ -21,17 +21,10 @@ inputs:
2121 github-token :
2222 description : ' The github token to access to the API'
2323 required : false
24- pr-id :
25- description : ' Id of the pull request'
26- required : true
27- github-repo :
28- description : ' The GitHub repository name (example, apache/camel)'
24+ base-ref :
25+ description : ' The base branch to compare against (defaults to github.base_ref)'
2926 required : false
30- default : ' apache/camel'
31- skip-mvnd-install :
32- description : ' Skip mvnd installation (use if already installed)'
33- required : false
34- default : ' false'
27+ default : ' '
3528runs :
3629 using : " composite"
3730 steps :
4235 - name : maven test
4336 env :
4437 GITHUB_TOKEN : ${{ inputs.github-token }}
45- MVND_DIR : ${{ steps.install-mvnd.outputs.mvnd-dir }}
46- PR_ID : ${{ inputs.pr-id }}
47- GITHUB_REPO : ${{ inputs.github-repo }}
4838 shell : bash
49- run : ${{ github.action_path }}/detect-test.sh "$MVND_DIR/mvnd" "$PR_ID" "$GITHUB_REPO"
50- - name : Post dependency change comment
51- if : always()
52- uses : actions/github-script@v8
53- with :
54- github-token : ${{ inputs.github-token }}
55- script : |
56- const fs = require('fs');
57- const commentFile = 'detect-dependencies-comment.md';
58- if (!fs.existsSync(commentFile)) return;
59- const body = fs.readFileSync(commentFile, 'utf8').trim();
60- if (!body) return;
61-
62- const prNumber = ${{ inputs.pr-id || 0 }};
63- if (!prNumber) {
64- core.warning('Could not determine PR number, skipping dependency comment');
65- return;
66- }
67-
68- const marker = '<!-- ci-parent-pom-deps -->';
69-
70- try {
71- const { data: comments } = await github.rest.issues.listComments({
72- owner: context.repo.owner,
73- repo: context.repo.repo,
74- issue_number: prNumber,
75- });
76- const existing = comments.find(c => c.body && c.body.includes(marker));
77-
78- if (existing) {
79- await github.rest.issues.updateComment({
80- owner: context.repo.owner,
81- repo: context.repo.repo,
82- comment_id: existing.id,
83- body: body,
84- });
85- } else {
86- await github.rest.issues.createComment({
87- owner: context.repo.owner,
88- repo: context.repo.repo,
89- issue_number: prNumber,
90- body: body,
91- });
92- }
93- } catch (error) {
94- core.warning(`Failed to post dependency change comment: ${error.message}`);
95- }
39+ run : ${{ github.action_path }}/detect-test.sh ${{ inputs.base-ref || github.base_ref }} ${{ steps.install-mvnd.outputs.mvnd-dir }}/mvnd
0 commit comments