Closed github-learning-lab[bot] closed 4 years ago
🎉 You've created this issue comment using GitHub Script!!!
@marceloserpa you're doing great! You've just used GitHub Script to comment on this issue!
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.
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!
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!
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/github-script@0.8.0
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: 10815337,
content_id: context.payload.issue.id,
content_type: "Issue"
});
Commit the workflow to a new branch.
Create a pull request, I suggest the title Add issues to project board.
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.
I have created a new pull request where we will continue this lesson. Click the link to meet me over there.
Look 👀 at you!
Super awesome job so far!
Do you remember what our workflow trigger was?
This means that every time an issue gets opened in this repository the GitHub Script you wrote will execute.
You should expect to see the result right here in this issue!
Workflow not running? Click here for some troubleshooting.
Try the following troubleshooting steps: 1. Click on the [Actions tab](https://github.com/marceloserpa/write-github-script/actions) to see the status of your workflow run. See [Managing a workflow run](https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run) on GitHub Help for more information. 1. Edit your [workflow file]( https://github.com/marceloserpa/write-github-script/edit/master/.github/workflows/my-workflow.yml) and look for errors in the linter built into the browser. 1. Look for the [workflow trigger](https://help.github.com/en/actions/reference/events-that-trigger-workflows) and ensure you are performing an action that triggers that workflow. If you need to make changes to your code, remove the [master branch protection](https://github.com/marceloserpa/write-github-script/settings/branches) and merge your changes into the `master` branch.I'll respond in this issue after your workflow runs!