GithubHelp home page GithubHelp logo

create-discussion's Introduction

Create-Discussion

Create a new GitHub Discussion with GitHub Actions

code style: 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:

    - 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. Replace <REPO_NAME> and <REPO_OWNER> with the repo you want to update.

query MyQuery {
  repository(name: "<REPO_NAME>", owner: "<REPO_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 that contains this action.

Credits

create-discussion's People

Contributors

abirismyname avatar andyfeller avatar dependabot[bot] avatar maju6406 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

create-discussion's Issues

Error: TypeError: Cannot read properties of null (reading 'discussion')

Hello,
Testing this action and keep getting the error in the subject, have you seen this before?

Nothing special configured as you can see below. I also tried to run with various versions of Node.js and they all return the same error.

            - name: Create a new GitHub Discussion
              id: create-discussion
              uses: abirismyname/[email protected]
              env:
                GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}      
              with:
                title: Title Goes Here
                body: |
                    Body goes here..
                repository-id: '***'
                category-id: '***'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.