Skip to content

Commit

Permalink
Merge pull request #699 from gsmet/pull_request_target
Browse files Browse the repository at this point in the history
Add support for pull_request_target (actions only!)
  • Loading branch information
gsmet authored Dec 13, 2024
2 parents 8f65de5 + 58b0c7e commit 1f89b49
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/developer-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ Here are all the events currently supported, together with the type of the paylo
|`@PullRequestReviewComment.Created`, `@PullRequestReviewComment.Deleted`, `@PullRequestReviewComment.Edited`
|link:{github-api-javadoc-root-url}/GHEventPayload.PullRequestReviewComment.html[`GHEventPayload.PullRequestReviewComment`]

|link:https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target[`pull_request_target`] (only for actions)
|`@PullRequestTarget.Assigned`, `@PullRequestTarget.Closed`, `@PullRequestTarget.Edited`, `@PullRequestTarget.Labeled`, `@PullRequestTarget.Locked`, `@PullRequestTarget.Opened`, `@PullRequestTarget.ReadyForReview`, `@PullRequestTarget.Reopened`, `@PullRequestTarget.ReviewRequested`, `@PullRequestTarget.ReviewRequestRemoved`, `@PullRequestTarget.Synchronize`, `@PullRequestTarget.Unassigned`, `@PullRequestTarget.Unlabeled`, `@PullRequestTarget.Unlocked`
|link:{github-api-javadoc-root-url}/GHEventPayload.PullRequest.html[`GHEventPayload.PullRequest`]

|link:{webhook-documentation-url}#push[`push`]
|`@Push`
|link:{github-api-javadoc-root-url}/GHEventPayload.Push.html[`GHEventPayload.Push`]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
package io.quarkiverse.githubapp.event;

import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.inject.Qualifier;

import org.kohsuke.github.GHEventPayload;

@Event(name = "pull_request_target", payload = GHEventPayload.PullRequest.class)
@Target({ PARAMETER, TYPE })
@Retention(RUNTIME)
@Qualifier
public @interface PullRequestTarget {

String value() default Actions.ALL;

@PullRequestTarget(Assigned.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Assigned {

String NAME = Actions.ASSIGNED;
}

@PullRequestTarget(Closed.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Closed {

String NAME = Actions.CLOSED;
}

@PullRequestTarget(Edited.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Edited {

String NAME = Actions.EDITED;
}

@PullRequestTarget(Labeled.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Labeled {

String NAME = Actions.LABELED;
}

@PullRequestTarget(Locked.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Locked {

String NAME = Actions.LOCKED;
}

@PullRequestTarget(Opened.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Opened {

String NAME = Actions.OPENED;
}

@PullRequestTarget(ReadyForReview.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface ReadyForReview {

String NAME = Actions.READY_FOR_REVIEW;
}

@PullRequestTarget(Reopened.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Reopened {

String NAME = Actions.REOPENED;
}

@PullRequestTarget(ReviewRequested.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface ReviewRequested {

String NAME = Actions.REVIEW_REQUESTED;
}

@PullRequestTarget(ReviewRequestRemoved.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface ReviewRequestRemoved {

String NAME = Actions.REVIEW_REQUEST_REMOVED;
}

@PullRequestTarget(Synchronize.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Synchronize {

String NAME = Actions.SYNCHRONIZE;
}

@PullRequestTarget(Unassigned.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Unassigned {

String NAME = Actions.UNASSIGNED;
}

@PullRequestTarget(Unlabeled.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Unlabeled {

String NAME = Actions.UNLABELED;
}

@PullRequestTarget(Unlocked.NAME)
@Target(PARAMETER)
@Retention(RUNTIME)
@Qualifier
public @interface Unlocked {

String NAME = Actions.UNLOCKED;
}

}

0 comments on commit 1f89b49

Please sign in to comment.