Giter Club home page Giter Club logo

Comments (4)

github-actions avatar github-actions commented on July 25, 2024

🎉 You've created this issue comment using GitHub Script!!!

from write-github-script.

github-learning-lab avatar github-learning-lab commented on July 25, 2024

Success 🎉!!!

@Vshalson you're doing great! You've just used GitHub Script to comment on this issue!

Why might this be useful?

Using GitHub Actions can really help automate the events that take place in your repositories. Imagine it was a repository visitor who opened a new issue containing information about a critical bug. I assume you'd want to thank them for bringing that to your attention, however this simple task can become overwhelming as your repository attracts more visitors. By automating an issue comment we could easily thank our visitors every single time without the overhead of doing it manually.

What about us?

For the rest of the course we are going to design a workflow that helps us move issues into a GitHub Project board when they are created. This will give us increased visibility on the work that needs triage!

from write-github-script.

github-learning-lab avatar github-learning-lab commented on July 25, 2024

Let's add a card to a project board

We have added a project board to this repository for you. We will use this board, named Learning Lab Project Board, to add cards to when a new issue is created in your repository!

Like creating comments and opening pull requests, octokit/rest.js can be used for many more types of interactions. Managing GitHub Projects makes that list!

Things aren't always as they appear!
Although this is not a course on octokit/rest.js, it is important to tell you a little secret right here before we move on. For you to be able to use the `projects.createCard()` method there were some pieces of information we needed beforehand. Things like the `column_id` so we know which column to add the card to and even a `project_id` so we know which board that column belongs to.

We've gone ahead and done this on our end of things so that we could give you the final piece to the puzzle and demonstrate how to use GitHub Script. So if you try to recreate this on your own, without the help of Learning Lab you will need to get that information and parse it in a way that works well for your use case!

⌨️ Activity: Add newly opened issue to project board

  1. Edit the current workflow .github/workflows/my-workflow.yml to have the following contents:

    name: Learning GitHub Script
    
    on:
      issues:
        types: [opened]
    
    jobs:
      comment:
        runs-on: ubuntu-latest
        steps:
        - uses: actions/[email protected]
          with:
            github-token: ${{secrets.GITHUB_TOKEN}}
            script: |
                github.issues.createComment({
                issue_number: context.issue.number,
                owner: context.repo.owner,
                repo: context.repo.repo,
                body: "🎉 You've created this issue comment using GitHub Script!!!"
                })
                github.projects.createCard({
                column_id: 15352355,
                content_id: context.payload.issue.id,
                content_type: "Issue"
                });
  2. Commit the workflow to a new branch.

  3. Create a pull request, I suggest the title Add issues to project board.

  4. Supply the pull request body content and click Create pull request.


I am waiting for you to create a new pull request before moving on.

I'll respond in the new pull request when I detect it has been created.

from write-github-script.

github-learning-lab avatar github-learning-lab commented on July 25, 2024

A new pull request

I have created a new pull request where we will continue this lesson. Click the link to meet me over there.

from write-github-script.

Related Issues (5)

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.