Compare commits

...

3 commits

Author SHA1 Message Date
Bjarne Koll
3e933fe49d [ci skip] Clean up paperclip build-pr workflow
Gracefully handle paperclip uploads to pull requests in case of build
workflow issues.
2024-05-28 14:23:35 +02:00
Jake Potrebic
483368e480
correct default to join-classpath: true for dependencies (#9279) 2023-06-08 07:08:58 -07:00
Nassim Jahnke
38b2754b28
[ci skip] Update test plugin 2023-06-08 15:44:29 +02:00
4 changed files with 41 additions and 30 deletions

View file

@ -34,15 +34,20 @@ jobs:
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
- name: Configure Build - name: Configure Build
uses: actions/github-script@v6 uses: actions/github-script@v7
id: determine id: determine
env:
REF_NAME: "${{ github.ref_name }}"
REF_TYPE: "${{ github.ref_type }}"
EVENT: "${{ toJSON(github.event) }}"
EVENT_TYPE: "${{ github.event_name }}"
with: with:
script: | script: |
const {owner, repo} = context.repo; const {owner, repo} = context.repo;
const event_name = "${{ github.event_name }}"; const event_name = `${process.env.EVENT_TYPE}`;
const event = ${{ toJSON(github.event) }}; const event = JSON.parse(`${process.env.EVENT}`);
const ref_type = "${{ github.ref_type }}"; const ref_type = `${process.env.REF_TYPE}`;
const ref_name = "${{ github.ref_name }}"; const ref_name = `${process.env.REF_NAME}`;
const result = { const result = {
action: "build" action: "build"
}; };

View file

@ -17,7 +17,15 @@ jobs:
if: github.event.workflow_run.conclusion == 'success' if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v6 - uses: actions/github-script@v7
env:
BRANCH_NAME: "${{ github.event.workflow_run.head_branch }}"
PR_OWNER: "${{ github.event.workflow_run.head_repository.owner.login }}"
PR_SHA: "${{ github.event.workflow_run.head_sha }}"
RUN_ID: "${{ github.event.workflow_run.id }}"
REPO_ID: "${{ github.event.repository.id }}"
EVENT_TYPE: "${{ github.event.workflow_run.event}}"
PULL_REQUESTS: "${{ toJSON(github.event.workflow_run.pull_requests) }}"
with: with:
# This snippet is public-domain, taken from # This snippet is public-domain, taken from
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml # https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
@ -37,17 +45,17 @@ jobs:
} }
const { owner, repo } = context.repo; const { owner, repo } = context.repo;
const run_id = ${{ github.event.workflow_run.id }}; const run_id = `${process.env.RUN_ID}`;
const repo_id = ${{ github.event.repository.id }}; const repo_id = `${process.env.REPO_ID}`;
let pulls = []; let pulls = [];
const event_type = "${{ github.event.workflow_run.event}}"; const event_type = `${process.env.EVENT_TYPE}`;
if (event_type === "push") { // if push, it's from the same repo which means `pull_requests` is populated if (event_type === "push") { // if push, it's from the same repo which means `pull_requests` is populated
pulls = ${{ toJSON(github.event.workflow_run.pull_requests) }}; pulls = JSON.parse(`${process.env.PULL_REQUESTS}`);
} else { } else {
const pr_branch = "${{ github.event.workflow_run.head_branch }}"; const pr_branch = `${process.env.BRANCH_NAME}`;
const pr_sha = "${{ github.event.workflow_run.head_sha }}"; const pr_sha = `${process.env.PR_SHA}`;
const pr_owner = "${{ github.event.workflow_run.head_repository.owner.login }}"; const pr_owner = `${process.env.PR_OWNER}`;
const { data } = await github.rest.pulls.list({ owner, repo, head: `${pr_owner}:${pr_branch}`, state: "open" }); const { data } = await github.rest.pulls.list({ owner, repo, head: `${pr_owner}:${pr_branch}`, state: "open" });
core.debug(JSON.stringify(data, null, 2)); core.debug(JSON.stringify(data, null, 2));
pulls = data.filter((pr) => pr.head.sha === pr_sha && pr.labels.find((l) => l.name === "build-pr-jar")); pulls = data.filter((pr) => pr.head.sha === pr_sha && pr.labels.find((l) => l.name === "build-pr-jar"));

View file

@ -5280,31 +5280,29 @@ index 0000000000000000000000000000000000000000..a0109a388188b0808900405d334a4031
+} +}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..594357f65813bd6287e982af12e4e5eaf443240e index 0000000000000000000000000000000000000000..957fb5e60ba6bd8760e8f6016d7bb6e8a405e163
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java
@@ -0,0 +1,32 @@ @@ -0,0 +1,30 @@
+package io.papermc.paper.plugin.provider.configuration.type; +package io.papermc.paper.plugin.provider.configuration.type;
+ +
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
+import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+ +
+import static java.util.Objects.requireNonNullElse;
+
+@DefaultQualifier(NonNull.class)
+@ConfigSerializable +@ConfigSerializable
+public record DependencyConfiguration( +public record DependencyConfiguration(
+ LoadOrder load, + LoadOrder load,
+ boolean required, + Boolean required,
+ boolean joinClasspath + Boolean joinClasspath
+) { +) {
+ + @SuppressWarnings("DataFlowIssue") // incorrect intellij inspections
+ public DependencyConfiguration(boolean required, boolean joinClasspath) { + public DependencyConfiguration {
+ this(LoadOrder.OMIT, required, joinClasspath); + required = requireNonNullElse(required, true);
+ } + joinClasspath = requireNonNullElse(joinClasspath, true);
+
+ public DependencyConfiguration(boolean required) {
+ this(required, true);
+ }
+
+ public DependencyConfiguration() {
+ this(true);
+ } + }
+ +
+ @ConfigSerializable + @ConfigSerializable

View file

@ -1,13 +1,13 @@
package io.papermc.testplugin; package io.papermc.testplugin;
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap; import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class TestPluginBootstrap implements PluginBootstrap { public class TestPluginBootstrap implements PluginBootstrap {
@Override @Override
public void bootstrap(@NotNull PluginProviderContext context) { public void bootstrap(@NotNull BootstrapContext context) {
} }
} }