From 33fba4cccfa69b1849bf3eed32f3db0d32fd75d0 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 27 Oct 2024 01:26:03 +0200 Subject: [PATCH 1/5] Try to fix distinction between PRs from us and forks --- .github/workflows/pr-comment.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index f8ad213aea3..55384f04c53 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -37,22 +37,22 @@ jobs: - uses: actions/checkout@v4 - name: Determine owner if: ${{ steps.read-pr_number.outputs.pr_number != '' }} - id: owner + id: isCrossRepository run: | - owner=$(gh pr view $pr_number --json headRepositoryOwner --jq '.headRepositoryOwner') - echo "Got owner $owner" - echo owner=$owner >> $GITHUB_OUTPUT + isCrossRepository=$(gh pr view $pr_number --json isCrossRepository --jq '.isCrossRepository') + echo "Got isCrossRepository $isCrossRepository" + echo isCrossRepository=$isCrossRepository >> $GITHUB_OUTPUT env: GH_TOKEN: ${{ github.token }} - name: Checkout - if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }} + if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.isCrossRepository.isCrossRepository == 'true') }} uses: actions/checkout@v4 with: fetch-depth: '0' show-progress: 'false' token: ${{ secrets.GITHUB_TOKEN }} - name: jbang - if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }} + if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.isCrossRepository.isCrossRepository == 'true') }} uses: jbangdev/jbang-action@v0.119.0 with: script: ghprcomment@koppor/ghprcomment From 08aa10c8c9521cca9f357128986f754784c7a763 Mon Sep 17 00:00:00 2001 From: Ricky-Du <141602008+u7465990@users.noreply.github.com> Date: Sun, 27 Oct 2024 10:32:25 +1100 Subject: [PATCH 2/5] Add VScode (#12089) * First version of the double click issue * updated codes * add the vscode to open the tex file * solve csl-styles * solve csl-locales * solve buildres/abbrv.jabref.org * Add the default path for VScode * ADD a todo for issue6775 --- .../java/org/jabref/gui/icon/IconTheme.java | 1 + .../gui/preferences/JabRefGuiPreferences.java | 5 +++ .../jabref/gui/push/PushToApplications.java | 4 +- .../org/jabref/gui/push/PushToVScode.java | 38 +++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/jabref/gui/push/PushToVScode.java diff --git a/src/main/java/org/jabref/gui/icon/IconTheme.java b/src/main/java/org/jabref/gui/icon/IconTheme.java index aa6cff98462..3788b551b18 100644 --- a/src/main/java/org/jabref/gui/icon/IconTheme.java +++ b/src/main/java/org/jabref/gui/icon/IconTheme.java @@ -283,6 +283,7 @@ public enum JabRefIcons implements JabRefIcon { APPLICATION_SUBLIMETEXT(JabRefMaterialDesignIcon.SUBLIME_TEXT), APPLICATION_TEXSHOP(JabRefMaterialDesignIcon.TEXSHOP), APPLICATION_TEXWORS(JabRefMaterialDesignIcon.TEXWORKS), + APPLICATION_VSCODE(JabRefMaterialDesignIcon.VSCODE), KEY_BINDINGS(MaterialDesignK.KEYBOARD), FIND_DUPLICATES(MaterialDesignC.CODE_EQUAL), CONNECT_DB(MaterialDesignC.CLOUD_UPLOAD), diff --git a/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java b/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java index 07bb423173b..2ab75d18cb7 100644 --- a/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java +++ b/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java @@ -139,6 +139,7 @@ public class JabRefGuiPreferences extends JabRefCliPreferences implements GuiPre private static final String PUSH_VIM_SERVER = "vimServer"; private static final String PUSH_VIM = "vim"; private static final String PUSH_SUBLIME_TEXT_PATH = "sublimeTextPath"; + private static final String PUSH_VSCODE_PATH = "VScodePath"; // endregion // region NameDisplayPreferences @@ -360,6 +361,7 @@ private JabRefGuiPreferences() { defaults.put(PUSH_VIM, "vim"); defaults.put(PUSH_VIM_SERVER, "vim"); defaults.put(PUSH_EMACS_ADDITIONAL_PARAMETERS, "-n -e"); + defaults.put(PUSH_VSCODE_PATH, OS.detectProgramPath("Code", "Microsoft VS Code")); if (OS.OS_X) { defaults.put(PUSH_EMACS_PATH, "emacsclient"); @@ -937,6 +939,7 @@ public PushToApplicationPreferences getPushToApplicationPreferences() { applicationCommands.put(PushToApplications.VIM, getEmptyIsDefault(PUSH_VIM)); applicationCommands.put(PushToApplications.WIN_EDT, getEmptyIsDefault(PUSH_WINEDT_PATH)); applicationCommands.put(PushToApplications.SUBLIME_TEXT, getEmptyIsDefault(PUSH_SUBLIME_TEXT_PATH)); + applicationCommands.put(PushToApplications.VSCODE, getEmptyIsDefault(PUSH_VSCODE_PATH)); pushToApplicationPreferences = new PushToApplicationPreferences( get(PUSH_TO_APPLICATION), @@ -971,6 +974,8 @@ private void storePushToApplicationPath(Map commandPair) { put(PUSH_WINEDT_PATH, value); case PushToApplications.SUBLIME_TEXT -> put(PUSH_SUBLIME_TEXT_PATH, value); + case PushToApplications.VSCODE -> + put(PUSH_VSCODE_PATH, value); } }); } diff --git a/src/main/java/org/jabref/gui/push/PushToApplications.java b/src/main/java/org/jabref/gui/push/PushToApplications.java index 08b551674a7..0a277e471a2 100644 --- a/src/main/java/org/jabref/gui/push/PushToApplications.java +++ b/src/main/java/org/jabref/gui/push/PushToApplications.java @@ -18,6 +18,7 @@ public class PushToApplications { public static final String WIN_EDT = "WinEdt"; public static final String SUBLIME_TEXT = "Sublime Text"; public static final String TEXSHOP = "TeXShop"; + public static final String VSCODE = "VScode"; private static final List APPLICATIONS = new ArrayList<>(); @@ -38,7 +39,8 @@ public static List getAllApplications(DialogService dialogSer new PushToTeXworks(dialogService, preferences), new PushToVim(dialogService, preferences), new PushToWinEdt(dialogService, preferences), - new PushToTexShop(dialogService, preferences))); + new PushToTexShop(dialogService, preferences), + new PushToVScode(dialogService, preferences))); return APPLICATIONS; } diff --git a/src/main/java/org/jabref/gui/push/PushToVScode.java b/src/main/java/org/jabref/gui/push/PushToVScode.java new file mode 100644 index 00000000000..6a40a1edf45 --- /dev/null +++ b/src/main/java/org/jabref/gui/push/PushToVScode.java @@ -0,0 +1,38 @@ +package org.jabref.gui.push; + +import java.nio.file.Path; + +import org.jabref.gui.DialogService; +import org.jabref.gui.icon.IconTheme; +import org.jabref.gui.icon.JabRefIcon; +import org.jabref.gui.preferences.GuiPreferences; + +public class PushToVScode extends AbstractPushToApplication { + + public static final String NAME = PushToApplications.VSCODE; + + public PushToVScode(DialogService dialogService, GuiPreferences preferences) { + super(dialogService, preferences); + } + + @Override + public String getDisplayName() { + return NAME; + } + + @Override + public JabRefIcon getApplicationIcon() { + return IconTheme.JabRefIcons.APPLICATION_VSCODE; + } + + @Override + protected String[] getCommandLine(String keyString) { + // TODO - Implementing this will fix https://github.com/JabRef/jabref/issues/6775 + return new String[] {commandPath}; + } + + @Override + public String[] jumpToLineCommandlineArguments(Path fileName, int line, int column) { + return new String[] {commandPath, "--g", "%s:%s:%s".formatted(fileName.toString(), line, column)}; + } +} From 61d342ad6bcb980e1680b2c897bfcd48792f0a35 Mon Sep 17 00:00:00 2001 From: "Baron.Mac" Date: Sun, 27 Oct 2024 10:45:30 +1100 Subject: [PATCH 3/5] Follow-up #12035 and #12068: Show an informative progress indicator when dragging and dropping PDF files to JabRef (#12072) * Updated changes following up for pull requests #12035 and #12068 * Updated CHANGELOG.md to display correct pull request * Updated StringUtil.shortenFileName to handle maxLength null case and added unit tests for maxLength null cases * Updated CHANGELOG.md to follow format and be more concise * Moved shortenFileName() to FileUtil * Refactored FileUtil.shortenFileName to better use of maxLength and Updated progress messages for Importing, Indexing files. --------- Co-authored-by: Baron Mac --- CHANGELOG.md | 1 + .../gui/externalfiles/ImportHandler.java | 18 ++++-- .../indexing/DefaultLinkedFilesIndexer.java | 7 ++- .../org/jabref/logic/util/io/FileUtil.java | 62 +++++++++++++++++++ src/main/resources/l10n/JabRef_en.properties | 7 ++- .../jabref/logic/util/io/FileUtilTest.java | 25 ++++++++ 6 files changed, 108 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc911099c31..7ff1b63f122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We added automatic browser extension install on Windows for Chrome and Edge. [#6076](https://github.com/JabRef/jabref/issues/6076) - We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686) - By double clicking on a local citation in the Citation Relations Tab you can now jump the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955) +- We use the menu icon for background tasks as a progress indicator to visualise an import's progress when dragging and dropping several PDF files into the main table. [#12072](https://github.com/JabRef/jabref/pull/12072) ### Changed diff --git a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java index 43038d286f5..9be3e860390 100644 --- a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java +++ b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java @@ -102,6 +102,7 @@ public BackgroundTask> importFilesInBackgro return new BackgroundTask<>() { private int counter; private final List results = new ArrayList<>(); + private final List allEntriesToAdd = new ArrayList<>(); @Override public List call() { @@ -115,8 +116,13 @@ public List call() { } UiTaskExecutor.runInJavaFXThread(() -> { - updateMessage(Localization.lang("Processing file %0", file.getFileName())); - updateProgress(counter, files.size() - 1d); + setTitle(Localization.lang("Importing files into %1 | %2 of %0 file(s) processed.", + files.size(), + bibDatabaseContext.getDatabasePath().map(path -> path.getFileName().toString()).orElse(Localization.lang("untitled")), + counter)); + updateMessage(Localization.lang("Processing %0", FileUtil.shortenFileName(file.getFileName().toString(), 68))); + updateProgress(counter, files.size()); + showToUser(true); }); try { @@ -168,10 +174,7 @@ public List call() { UiTaskExecutor.runInJavaFXThread(() -> updateMessage(Localization.lang("Error"))); } - - // We need to run the actual import on the FX Thread, otherwise we will get some deadlocks with the UIThreadList - // That method does a clone() on each entry - UiTaskExecutor.runInJavaFXThread(() -> importEntries(entriesToAdd)); + allEntriesToAdd.addAll(entriesToAdd); ce.addEdit(new UndoableInsertEntries(bibDatabaseContext.getDatabase(), entriesToAdd)); ce.end(); @@ -180,6 +183,9 @@ public List call() { counter++; } + // We need to run the actual import on the FX Thread, otherwise we will get some deadlocks with the UIThreadList + // That method does a clone() on each entry + UiTaskExecutor.runInJavaFXThread(() -> importEntries(allEntriesToAdd)); return results; } diff --git a/src/main/java/org/jabref/logic/search/indexing/DefaultLinkedFilesIndexer.java b/src/main/java/org/jabref/logic/search/indexing/DefaultLinkedFilesIndexer.java index 50683c8d8f6..bf7386ddef3 100644 --- a/src/main/java/org/jabref/logic/search/indexing/DefaultLinkedFilesIndexer.java +++ b/src/main/java/org/jabref/logic/search/indexing/DefaultLinkedFilesIndexer.java @@ -23,6 +23,7 @@ import org.jabref.logic.util.BackgroundTask; import org.jabref.logic.util.HeadlessExecutorService; import org.jabref.logic.util.StandardFileType; +import org.jabref.logic.util.io.FileUtil; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; @@ -133,8 +134,6 @@ private void addToIndex(Map> linkedFiles, BackgroundTas return; } - task.setTitle(Localization.lang("Indexing PDF files for %0", libraryName)); - task.showToUser(true); LOGGER.debug("Adding {} files to index", linkedFiles.size()); int i = 1; for (Map.Entry> entry : linkedFiles.entrySet()) { @@ -143,8 +142,10 @@ private void addToIndex(Map> linkedFiles, BackgroundTas return; } addToIndex(entry.getKey(), entry.getValue().getKey(), entry.getValue().getValue()); + task.setTitle(Localization.lang("Indexing files for %1 | %2 of %0 file(s) indexed.", linkedFiles.size(), libraryName, i)); task.updateProgress(i, linkedFiles.size()); - task.updateMessage(Localization.lang("Indexing %0. %1 of %2 files added to the index.", entry.getValue().getValue().getFileName(), i, linkedFiles.size())); + task.updateMessage(Localization.lang("Indexing %0", FileUtil.shortenFileName(entry.getValue().getValue().getFileName().toString(), 68))); + task.showToUser(true); i++; } LOGGER.debug("Added {} files to index", linkedFiles.size()); diff --git a/src/main/java/org/jabref/logic/util/io/FileUtil.java b/src/main/java/org/jabref/logic/util/io/FileUtil.java index 749b7d56cd4..3240e64034f 100644 --- a/src/main/java/org/jabref/logic/util/io/FileUtil.java +++ b/src/main/java/org/jabref/logic/util/io/FileUtil.java @@ -45,6 +45,8 @@ public class FileUtil { public static final int MAXIMUM_FILE_NAME_LENGTH = 255; private static final Logger LOGGER = LoggerFactory.getLogger(FileUtil.class); + private static final String ELLIPSIS = "..."; + private static final int ELLIPSIS_LENGTH = ELLIPSIS.length(); /** * MUST ALWAYS BE A SORTED ARRAY because it is used in a binary search @@ -523,6 +525,66 @@ public static boolean detectBadFileName(String fileName) { return false; } + /** + * Shorten a given file name in the middle of the name using ellipsis. Example: verylongfilenameisthis.pdf + * with maxLength = 20 is shortened into verylo...isthis.pdf + * + * @param fileName the given file name to be shortened + * @param maxLength the maximum number of characters in the string after shortening (including the extension) + * @return the original fileName if fileName.length() <= maxLength. Otherwise, a shortened fileName + */ + public static String shortenFileName(String fileName, Integer maxLength) { + if (fileName == null || maxLength == null || maxLength < ELLIPSIS_LENGTH) { + return ""; + } + + if (fileName.length() <= maxLength) { + return fileName; + } + + String name; + String extension; + + extension = FileUtil.getFileExtension(fileName).map(fileExtension -> '.' + fileExtension).orElse(""); + if (extension.isEmpty()) { + name = fileName; + } else { + name = fileName.substring(0, fileName.length() - extension.length()); + } + + int totalNeededLength = ELLIPSIS_LENGTH + extension.length(); + if (maxLength <= totalNeededLength) { + return fileName.substring(0, maxLength - ELLIPSIS_LENGTH) + ELLIPSIS; + } + + int charsForName = maxLength - totalNeededLength; + if (charsForName <= 0) { + return ELLIPSIS + extension; + } + + int numCharsBeforeEllipsis; + int numCharsAfterEllipsis; + if (charsForName == 1) { + numCharsBeforeEllipsis = 1; + numCharsAfterEllipsis = 0; + } else { + // Allow the front part to have the extra in odd cases + numCharsBeforeEllipsis = (charsForName + 1) / 2; + numCharsAfterEllipsis = charsForName / 2; + } + + numCharsBeforeEllipsis = Math.min(numCharsBeforeEllipsis, name.length()); + numCharsAfterEllipsis = Math.min(numCharsAfterEllipsis, name.length() - numCharsBeforeEllipsis); + + StringBuilder result = new StringBuilder(); + result.append(name, 0, numCharsBeforeEllipsis) + .append(ELLIPSIS) + .append(name.substring(name.length() - numCharsAfterEllipsis)) + .append(extension); + + return result.toString(); + } + public static boolean isCharLegal(char c) { return Arrays.binarySearch(ILLEGAL_CHARS, c) < 0; } diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 7505818e8fe..94119350460 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -319,7 +319,8 @@ Extract\ References\ (online)=Extract References (online) Processing...=Processing... Processing\ "%0"...=Processing "%0"... Processing\ PDF(s)=Processing PDF(s) -Processing\ file\ %0=Processing file %0 +Processing\ %0=Processing %0 +Importing\ files\ into\ %1\ |\ %2\ of\ %0\ file(s)\ processed.=Importing files into %1 | %2 of %0 file(s) processed. Processing\ a\ large\ number\ of\ files=Processing a large number of files You\ are\ about\ to\ process\ %0\ files.\ Continue?=You are about to process %0 files. Continue? @@ -490,10 +491,10 @@ Independent\ group\:\ When\ selected,\ view\ only\ this\ group's\ entries=Indepe I\ Agree=I Agree Indexing\ bib\ fields\ for\ %0=Indexing bib fields for %0 -Indexing\ PDF\ files\ for\ %0=Indexing PDF files for %0 +Indexing\ %0=Indexing %0 +Indexing\ files\ for\ %1\ |\ %2\ of\ %0\ file(s)\ indexed.=Indexing files for %1 | %2 of %0 file(s) indexed. %0\ of\ %1\ entries\ added\ to\ the\ index.=%0 of %1 entries added to the index. %0\ of\ %1\ entries\ removed\ from\ the\ index.=%0 of %1 entries removed from the index. -Indexing\ %0.\ %1\ of\ %2\ files\ added\ to\ the\ index.=Indexing %0. %1 of %2 files added to the index. Removing\ entries\ from\ index\ for\ %0=Removing entries from index for %0 Invalid\ URL=Invalid URL diff --git a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java index 416b898429a..e09b5e89b8e 100644 --- a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; @@ -477,4 +478,28 @@ void legalPaths(String fileName) { void illegalPaths(String fileName) { assertTrue(FileUtil.detectBadFileName(fileName)); } + + @ParameterizedTest + @CsvSource({ + "'' , , ", + "'' , , -3", + "'' , , 0", + "'' , , 3", + "'' , , 5", + "'' , , 10", + "'' , thisisatestfile.pdf , ", + "'' , thisisatestfile.pdf , -5", + "'' , thisisatestfile.pdf , 0", + "... , thisisatestfile.pdf , 3", + "th... , thisisatestfile.pdf , 5", + "th...e.pdf , thisisatestfile.pdf , 10", + "thisisatestfile.pdf , thisisatestfile.pdf , 20", + "lo... , longfilename.extremelylongextension , 5", + "longfil... , longfilename.extremelylongextension , 10", + "longfilename.extr... , longfilename.extremelylongextension , 20", + "lo...me.extremelylongextension , longfilename.extremelylongextension , 30", + }) + void shortenFileName(String expected, String fileName, Integer maxLength) { + assertEquals(expected, FileUtil.shortenFileName(fileName, maxLength)); + } } From 734ceece8bc2d8ad664d8e7b49315ba8e9512787 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 27 Oct 2024 01:49:45 +0200 Subject: [PATCH 4/5] Limit some workflows to main repository (#12097) --- .github/workflows/assign-issue.yml | 1 + .github/workflows/check-links.yml | 1 + .github/workflows/cleanup-pr.yml | 16 +--------------- .github/workflows/deployment-arm64.yml | 1 + .github/workflows/deployment-jdk-ea.yml | 1 + .github/workflows/gource.yml | 1 + .github/workflows/on-labeled-issue.yml | 12 ++++++------ .github/workflows/on-labeled-pr.yml | 2 +- .github/workflows/on-unlabeled-issue.yml | 2 +- .github/workflows/pr-comment.yml | 2 +- .github/workflows/update-gradle-wrapper.yml | 1 + 11 files changed, 16 insertions(+), 24 deletions(-) diff --git a/.github/workflows/assign-issue.yml b/.github/workflows/assign-issue.yml index e88f6b762d2..a4c8899c249 100644 --- a/.github/workflows/assign-issue.yml +++ b/.github/workflows/assign-issue.yml @@ -9,6 +9,7 @@ on: jobs: assign: + if: github.repository_owner == 'JabRef' runs-on: ubuntu-latest permissions: issues: write diff --git a/.github/workflows/check-links.yml b/.github/workflows/check-links.yml index 67881841c46..ce4c607f16c 100644 --- a/.github/workflows/check-links.yml +++ b/.github/workflows/check-links.yml @@ -18,6 +18,7 @@ concurrency: jobs: lychee: + if: github.repository_owner == 'JabRef' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/cleanup-pr.yml b/.github/workflows/cleanup-pr.yml index bd38e11ea16..ecd3936ef52 100644 --- a/.github/workflows/cleanup-pr.yml +++ b/.github/workflows/cleanup-pr.yml @@ -7,27 +7,14 @@ on: jobs: cleanup: runs-on: ubuntu-latest + if: github.repository_owner == 'JabRef' steps: - name: Cancel deployment run uses: styfle/cancel-workflow-action@0.12.1 with: ignore_sha: true workflow_id: 9813 # workflow "Deployment" - - name: Check secrets presence - id: checksecrets - shell: bash - run: | - if [ "$BUILDJABREFPRIVATEKEY" == "" ]; then - echo "secretspresent=NO" >> $GITHUB_OUTPUT - echo "❌ Secret BUILDJABREFPRIVATEKEY not present" - else - echo "secretspresent=YES" >> $GITHUB_OUTPUT - echo "✔️ Secret BUILDJABREFPRIVATEKEY present" - fi - env: - BUILDJABREFPRIVATEKEY: ${{ secrets.buildJabRefPrivateKey }} - name: Delete folder on builds.jabref.org - if: steps.checksecrets.outputs.secretspresent == 'YES' uses: appleboy/ssh-action@v1.1.0 with: script: rm -rf /var/www/builds.jabref.org/www/pull/${{ github.event.pull_request.number }} || true @@ -36,7 +23,6 @@ jobs: username: jrrsync key: ${{ secrets.buildJabRefPrivateKey }} - name: Update PR comment - if: steps.checksecrets.outputs.secretspresent == 'YES' uses: thollander/actions-comment-pull-request@v3 with: comment-tag: download-link diff --git a/.github/workflows/deployment-arm64.yml b/.github/workflows/deployment-arm64.yml index cd360c1f474..231fb3f15cb 100644 --- a/.github/workflows/deployment-arm64.yml +++ b/.github/workflows/deployment-arm64.yml @@ -34,6 +34,7 @@ concurrency: jobs: build: + if: github.repository_owner == 'JabRef' strategy: fail-fast: false matrix: diff --git a/.github/workflows/deployment-jdk-ea.yml b/.github/workflows/deployment-jdk-ea.yml index 2bc7390f568..e956241d703 100644 --- a/.github/workflows/deployment-jdk-ea.yml +++ b/.github/workflows/deployment-jdk-ea.yml @@ -32,6 +32,7 @@ concurrency: jobs: build: + if: github.repository_owner == 'JabRef' strategy: fail-fast: false matrix: diff --git a/.github/workflows/gource.yml b/.github/workflows/gource.yml index cfdbc44d6e0..3bccc1f3d14 100644 --- a/.github/workflows/gource.yml +++ b/.github/workflows/gource.yml @@ -15,6 +15,7 @@ concurrency: jobs: action: + if: github.repository_owner == 'JabRef' runs-on: ubuntu-latest steps: - name: 'Checkout' diff --git a/.github/workflows/on-labeled-issue.yml b/.github/workflows/on-labeled-issue.yml index 8cc260e8939..93e65e1cf66 100644 --- a/.github/workflows/on-labeled-issue.yml +++ b/.github/workflows/on-labeled-issue.yml @@ -9,7 +9,7 @@ jobs: Assigned: # Triggered when manually assigned the label "📍 Assigned" to trigger the automatic unassignment after 30 days name: "📍 Assigned" - if: ${{ github.event.label.name == '📍 Assigned' }} + if: ${{ github.event.label.name == '📍 Assigned' && github.repository_owner == 'JabRef' }} runs-on: ubuntu-latest permissions: issues: write @@ -35,7 +35,7 @@ jobs: default-column: "Free to take" skip-if-not-in-project: true FirstTimeCodeContribution: - if: ${{ github.event.label.name == 'FirstTimeCodeContribution' }} + if: ${{ github.event.label.name == 'FirstTimeCodeContribution' && github.repository_owner == 'JabRef' }} runs-on: ubuntu-latest permissions: issues: write @@ -80,7 +80,7 @@ jobs: skip-if-not-in-project: true good-first-issue: name: "good first issue" - if: "${{ github.event.label.name == 'good first issue' }}" + if: "${{ github.event.label.name == 'good first issue' && github.repository_owner == 'JabRef' }}" runs-on: ubuntu-latest steps: - name: "good first issue" @@ -90,7 +90,7 @@ jobs: ISSUE_URL=$(jq --raw-output .issue.html_url "$GITHUB_EVENT_PATH") gh project item-add 5 --owner JabRef --url $ISSUE_URL needs-refinement: - if: github.event.label.name == 'needs-refinement' + if: github.event.label.name == 'needs-refinement' && github.repository_owner == 'JabRef' runs-on: ubuntu-latest steps: - name: needs-refinement @@ -101,7 +101,7 @@ jobs: gh project item-add 15 --owner JabRef --url $ISSUE_URL status-freeze: name: "status: freeze" - if: "${{ github.event.label.name == 'status: freeze' }}" + if: "${{ github.event.label.name == 'status: freeze' && github.repository_owner == 'JabRef' }}" runs-on: ubuntu-latest steps: - name: "status: freeze" @@ -111,7 +111,7 @@ jobs: ISSUE_URL=$(jq --raw-output .issue.html_url "$GITHUB_EVENT_PATH") gh project item-add 9 --owner JabRef --url $ISSUE_URL ui: - if: "${{ github.event.label.name == 'ui' }}" + if: "${{ github.event.label.name == 'ui' && github.repository_owner == 'JabRef' }}" runs-on: ubuntu-latest steps: - name: ui diff --git a/.github/workflows/on-labeled-pr.yml b/.github/workflows/on-labeled-pr.yml index 4ceb3844fe7..2e64d79f1f7 100644 --- a/.github/workflows/on-labeled-pr.yml +++ b/.github/workflows/on-labeled-pr.yml @@ -8,7 +8,7 @@ on: jobs: automerge: name: Auto Merge - if: "${{ github.event.label.name == 'automerge' }}" + if: "${{ github.event.label.name == 'automerge' && github.repository_owner == 'JabRef' }}" runs-on: ubuntu-latest steps: - name: Approve PR diff --git a/.github/workflows/on-unlabeled-issue.yml b/.github/workflows/on-unlabeled-issue.yml index 9c5870066ca..64872289b3d 100644 --- a/.github/workflows/on-unlabeled-issue.yml +++ b/.github/workflows/on-unlabeled-issue.yml @@ -7,7 +7,7 @@ on: jobs: FirstTimeCodeContribution_or_Assigned: - if: ${{ (github.event.label.name == 'FirstTimeCodeContribution') || (github.event.label.name == '📍 Assigned') }} + if: ${{ ((github.event.label.name == 'FirstTimeCodeContribution') || (github.event.label.name == '📍 Assigned')) && github.repository_owner == 'JabRef' }} runs-on: ubuntu-latest permissions: issues: write diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 55384f04c53..b93face4b88 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -14,7 +14,7 @@ on: jobs: comment: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow - if: ${{ github.event.workflow_run.conclusion == 'failure' }} + if: ${{ github.event.workflow_run.conclusion == 'failure' && (github.repository_owner == 'JabRef') }} runs-on: ubuntu-latest permissions: actions: read diff --git a/.github/workflows/update-gradle-wrapper.yml b/.github/workflows/update-gradle-wrapper.yml index 826a211b195..f65338cf884 100644 --- a/.github/workflows/update-gradle-wrapper.yml +++ b/.github/workflows/update-gradle-wrapper.yml @@ -7,6 +7,7 @@ on: jobs: update-gradle-wrapper: + if: github.repository_owner == 'JabRef' runs-on: ubuntu-latest steps: From f0d8632c5410813422b79bb420ed682fed7cb5a6 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 27 Oct 2024 02:18:52 +0200 Subject: [PATCH 5/5] Fix reading PR number --- .github/workflows/pr-comment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index b93face4b88..e6fe90e40f9 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -44,6 +44,7 @@ jobs: echo isCrossRepository=$isCrossRepository >> $GITHUB_OUTPUT env: GH_TOKEN: ${{ github.token }} + pr_number: ${{ steps.read-pr_number.outputs.pr_number }} - name: Checkout if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.isCrossRepository.isCrossRepository == 'true') }} uses: actions/checkout@v4