Skip to content

Wei18/GitHubSwiftActions

Repository files navigation

GitHub Swift Actions (Beta)

Overview

This repository contains GitHub Composite Actions built using Swift.

Ideas

This is a series of combinations:

  • To create convenient use cases, a Swift package executable was created,
  • To create GitHub Composite Actions,
    • the Yams dependency is used: Yams
  • Then, GitHub Actions are utilized
    • to build the Swift package executable via Mint: Mint
    • and to cache the Swift package executable via: setup-mint

Action: Release

Description

The Release action creates on GitHub release using a Swift CLI tool. You can use it to bump major, minor, patch.

Action: Comment

Description

The Comment action comments on GitHub issues using a Swift CLI tool. You can use it to automatically craete or update comments.

Inputs

The Comment action requires the following inputs:

  • number: (required) The issue number to comment on.
  • body: (required) The body of the comment.
  • owner: (required) The owner of the repository.
  • repo: (required) The name of the repository.
  • token: (required) GitHub token with permissions to comment.
  • anchor: (required) Anchor text for the comment.

Example Usage

To use the Comment action in a GitHub Actions workflow, create a YAML file in the .github/workflows directory of your repository:

name: Welcome
on:
issues:
types: [opened, reopened]
jobs:
say-hello-to-reporter:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
steps:
- uses: Wei18/GitHubSwiftActions/Actions/Comment@main
with:
number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }},
Thank you for opening this issue! We will review it and get back to you as soon as possible.
If you have any additional details or questions, please feel free to update this issue.
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
token: ${{ secrets.GITHUB_TOKEN }}
anchor: "welcome-comment"

Building the Action

To run the Comment action locally, use:

swift run --configuration release Comment

Contributing

Feel free to open issues or submit pull requests if you have improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.