Skip to content

quarkiverse/quarkus-github-action

Repository files navigation

Quarkus GitHub Action

Version

All Contributors

Develop your GitHub Actions in Java with Quarkus

Interested in GitHub Apps? Have a look at the Quarkus GitHub App extension.

Quarkus GitHub Action is a Quarkus extension that allows to create GitHub Actions in Java with very little boilerplate.

And yes, it supports generating native executables with GraalVM or Mandrel.

Your GitHub Action will look like:

class MyAction {

  @Action
  void doSomething() {
    // do something useful here
  }
}

Or you can also leverage the GitHub REST API (GraphQL is also supported), get the execution context, get the inputs, execute commands... with something a bit more involved:

class MyAction {

  @Action
  void onIssueOpened(@Issue.Opened GHEventPayload.Issue issuePayload, Context context, Inputs inputs, Commands commands) throws IOException {
    // Add a comment to the issue who triggered the job
    issuePayload.getIssue().comment("Hello from MyAction");

    // Set the value of an output
    commands.setOutput("output-key", "the value");

    // Append Markdown to the job summary
    commands.appendJobSummary(":wave: Hello from Quarkus GitHub Action");
  }
}

Quarkus GitHub Action will automatically inject all these fully initialized instances in the @Action methods for you.

Focus on your business logic and don't bother about the ceremony.

Compatibility

Quarkus GitHub Action 2.x is compatible with Quarkus 3.x.

We recommend using the latest versions of both for the best experience.

Documentation

To get you started (and more!), please refer to the extensive documentation.

Anything unclear or missing in the documentation? Please open an issue, we will address it quickly.

Examples

How?

The Quarkus GitHub Action extension uses the Hub4j GitHub API to parse the webhook payloads and handle the GitHub REST API calls.

It can also execute GraphQL queries towards the GitHub GraphQL API via the SmallRye GraphQL Client.

The rest of the extension is Quarkus magic - mostly code generation with Gizmo - to get everything wired.

Status

This extension is considered stable and is used in production.

It relies on the exact same principles as the Quarkus GitHub App extension.

License

This project is licensed under the Apache License Version 2.0.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Guillaume Smet
Guillaume Smet

💻 🚧
Jan-Petter Krüger
Jan-Petter Krüger

💻

This project follows the all-contributors specification. Contributions of any kind welcome!