Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abirismyname/create-discussion
Create a new GitHub Discussion with GitHub Actions
https://github.com/abirismyname/create-discussion
Last synced: 3 months ago
JSON representation
Create a new GitHub Discussion with GitHub Actions
- Host: GitHub
- URL: https://github.com/abirismyname/create-discussion
- Owner: abirismyname
- License: isc
- Created: 2022-03-10T19:58:34.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T10:41:25.000Z (7 months ago)
- Last Synced: 2024-10-02T23:45:53.683Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 29.2 MB
- Stars: 10
- Watchers: 1
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-ccamel - abirismyname/create-discussion - Create a new GitHub Discussion with GitHub Actions (TypeScript)
README
# Create-Discussion
Create a new GitHub Discussion with GitHub Actions
![](https://github.com/abirismyname/create-discussion/workflows/tests/badge.svg) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
## About
This action allows you to create a new GitHub Discussion with GitHub Actions.
## Usage
In your workflow, to create a new discussion, include a step like this:
```yaml
- name: Create a new GitHub Discussion
id: create-discussion
uses: abirismyname/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: Feelings
body: |
Let's talk!
repository-id: ${{ secrets.REPO_ID }}
category-id: ${{ secrets.CAT_ID }}
- name: Print discussion url and id
run: |
echo discussion-id: ${{steps.create-discussion.outputs.discussion-id}}
echo discussion-url: ${{steps.create-discussion.outputs.discussion-url}}
```## Inputs
The following inputs are _required_:
- `title`: The title of the discussion
- `body`: The body of the discussion
- `body-filepath`: The path to a file containing the body of the new discussion (takes precedence over `body`).**
- `repository-id`: The ID of the repository for the new discussion
- `category-id`: The ID of the category for the new discussion.** If you are using `body-filepath` be sure to add a `actions/checkout` action before this action in the workflow to make sure the file exists in the action workspace.
### Obtaining the `repository-id` and `category-id`
You can find `repository-id` and `category-id` using [GitHub's GraphQL Explorer](https://docs.github.com/en/graphql/overview/explorer). Replace `` and `` with the repo you want to update.
```graphql
query MyQuery {
repository(name: "", owner: "") {
id
discussionCategories(first: 10) {
edges {
node {
id
name
}
cursor
}
}
}
}
```## Outputs
This action provides the following outputs:
- `discussion-id`: ID of created discussion
- `discussion-url`: URL of created discussion## Example
This repo contains an example [workflow](https://github.com/abirismyname/create-discussion/blob/main/.github/workflows/example.yml) that contains this action.
## Credits
- :bow: Based on [swinton/commit](https://github.com/swinton/commit).
- :bow: [@imjohnbo](imjohnbo) for the inspiration.