Skip to content

Commit 939b018

Browse files
authored
Switch from jbang-action to setup-jbang for ghprcomment.java (#14426)
1 parent a9577aa commit 939b018

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

.github/workflows/pr-comment.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,35 @@ jobs:
9090
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9191

9292
# This step runs in both cases using the proper variables.
93-
- name: ghprcomment@main
93+
- name: Setup JDK
94+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
95+
uses: actions/setup-java@v5
96+
with:
97+
# java version supported by ghprcomment.java - https://github.com/koppor/ghprcomment/blob/2b1060508ebb51d137698fe66f5c20d9012b2be9/ghprcomment.java#L3
98+
java-version: '24'
99+
distribution: 'corretto'
100+
check-latest: true
101+
- name: Generate JBang cache key
102+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
103+
id: cache-key
104+
shell: bash
105+
run: |
106+
echo "cache_key=jbang-$(date +%Y-%m)" >> $GITHUB_OUTPUT
107+
- name: Use cache
94108
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
95-
uses: jbangdev/[email protected]
109+
uses: actions/cache/restore@v4
96110
with:
97-
script: https://github.com/koppor/ghprcomment/blob/main/ghprcomment.java
98-
scriptargs: "-r JabRef/jabref -p ${{ steps.set-vars.outputs.pr_number }} -w ${{ steps.set-vars.outputs.workflow_run_id }}"
99-
trust: https://github.com/koppor/ghprcomment/
111+
path: ~/.jbang
112+
key: ${{ steps.cache-key.outputs.cache_key }}
113+
restore-keys:
114+
jbang-
115+
- name: Setup JBang
116+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
117+
uses: jbangdev/setup-jbang@main
118+
- name: ghprcomment@main
119+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
120+
run: |
121+
jbang trust add https://github.com/koppor/ghprcomment/blob/main/ghprcomment.java
122+
jbang https://github.com/koppor/ghprcomment/blob/main/ghprcomment.java -r JabRef/jabref -p ${{ steps.set-vars.outputs.pr_number }} -w ${{ steps.set-vars.outputs.workflow_run_id }}
100123
env:
101124
GITHUB_OAUTH: ${{ secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE }}

0 commit comments

Comments
 (0)