From e6a6cf690333ce8b0fd8a01f2ede34232419fcc6 Mon Sep 17 00:00:00 2001 From: Dave Burnison Date: Wed, 30 Dec 2020 15:28:35 -0800 Subject: [PATCH] Dynamic comment --- .github/workflows/my-workflow.yml | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/my-workflow.yml b/.github/workflows/my-workflow.yml index 070f865..f632560 100644 --- a/.github/workflows/my-workflow.yml +++ b/.github/workflows/my-workflow.yml @@ -8,16 +8,29 @@ 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!!!" - }) + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Comment on new issue + uses: actions/github-script@0.8.0 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const fs = require('fs') + const issueBody = fs.readFileSync(".github/ISSUE_RESPONSES/comment.md", "utf8") + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: issueBody + }) + + - name: Add issue to project board + if: contains(github.event.issue.labels.*.name, 'bug') + uses: actions/github-script@0.8.0 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | github.projects.createCard({ column_id: 12270352, content_id: context.payload.issue.id,