From 59696e5e95ca6e651847db6c319b13b706b09d61 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 13:35:03 -0600 Subject: [PATCH 01/16] Test action --- .github/checklist.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/checklist.md b/.github/checklist.md index ea6daeb..3e20ceb 100644 --- a/.github/checklist.md +++ b/.github/checklist.md @@ -1,2 +1,3 @@ [ ] item 1 -[ ] item 2 \ No newline at end of file +[ ] item 2 +[ ] item 3 \ No newline at end of file From 47127a3552b886f68523dcd64778ccf29a9beef3 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:40:40 -0600 Subject: [PATCH 02/16] Test action --- action.yml | 11 ++++++++++- index.js | 13 +++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 371855c..8ebf7c9 100644 --- a/action.yml +++ b/action.yml @@ -5,10 +5,19 @@ inputs: description: 'Path of checklist location relative to the context of files available in the runner' default: "./.github/checklist.md" required: true - repo_token: + repository_token: description: "A GitHub token for API access. Defaults to {{ github.token }}." default: "${{ github.token }}" required: true + repository_owner: + description: "The repository owner." + default: "${{ github.repository_owner }}" + required: true + repository_name: + description: "The repository name." + default: "${{ github.event.repository.name }}" + required: true + runs: using: 'node20' main: 'index.js' \ No newline at end of file diff --git a/index.js b/index.js index b67a8ba..b4e6c22 100644 --- a/index.js +++ b/index.js @@ -3,12 +3,21 @@ const fs = require("fs/promises"); const github = require('@actions/github'); const checklistPath = core.getInput('checklist_path'); -const repoToken = core.getInput('repo_token'); -const octokit = github.getOctokit(repoToken); +const repositoryToken = core.getInput('repository_token'); +const repositoryOwner = core.getInput('repository_owner'); +const repositoryName = core.getInput('repository_name'); + +const octokit = github.getOctokit(repositoryToken); (async () => { try { const checklistContent = await fs.readFile(checklistPath, "utf8"); + octokit.rest.issues.createComment({ + repositoryOwner, + repositoryName, + issue_number: 1,// github.context.pull_request.number, + checklistContent, + }); console.log(github.context); } catch (error) { console.log(error.message); From 54049475e4a119f93e0e1f692cf24bda0e4d713e Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:43:54 -0600 Subject: [PATCH 03/16] Test action --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8aaff6..8a7309a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ on: jobs: test: runs-on: ubuntu-22.04 + permissions: + pull-requests: write steps: - name: Check out repo uses: actions/checkout@v4 From ed9ff5d7feb9ec4929252f637df37c9de45a4a7a Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:47:30 -0600 Subject: [PATCH 04/16] Test action --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a7309a..198d64d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,9 @@ name: Test on: - pull_request: - types: [opened] + push: + branches: + - "**" jobs: test: From bc84ee7361fa9820f362defc28536cb305d5c073 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:52:14 -0600 Subject: [PATCH 05/16] Test action --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 198d64d..96e8c03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ jobs: test: runs-on: ubuntu-22.04 permissions: + contents: read pull-requests: write steps: - name: Check out repo From 9c2701f452e5ace5abb7b5ebb46ec92f4f4ad471 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:53:44 -0600 Subject: [PATCH 06/16] Test action --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index b4e6c22..0ca1333 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,9 @@ const repositoryToken = core.getInput('repository_token'); const repositoryOwner = core.getInput('repository_owner'); const repositoryName = core.getInput('repository_name'); +console.log('owner', repositoryOwner); +console.log('name', repositoryName); + const octokit = github.getOctokit(repositoryToken); (async () => { From a9d7631c87f31f3001943cd80b60a14d82704696 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:56:38 -0600 Subject: [PATCH 07/16] Test action --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0ca1333..f5c1e8e 100644 --- a/index.js +++ b/index.js @@ -16,9 +16,9 @@ const octokit = github.getOctokit(repositoryToken); try { const checklistContent = await fs.readFile(checklistPath, "utf8"); octokit.rest.issues.createComment({ - repositoryOwner, - repositoryName, issue_number: 1,// github.context.pull_request.number, + repositoryOwner, + repositoryName, checklistContent, }); console.log(github.context); From 431459a771d6259b960486caee14cd35375d5687 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 14:58:22 -0600 Subject: [PATCH 08/16] Test action --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f5c1e8e..84c48cb 100644 --- a/index.js +++ b/index.js @@ -7,18 +7,21 @@ const repositoryToken = core.getInput('repository_token'); const repositoryOwner = core.getInput('repository_owner'); const repositoryName = core.getInput('repository_name'); -console.log('owner', repositoryOwner); -console.log('name', repositoryName); + const octokit = github.getOctokit(repositoryToken); (async () => { try { + + console.log('owner', repositoryOwner); + console.log('name', repositoryName); + const checklistContent = await fs.readFile(checklistPath, "utf8"); octokit.rest.issues.createComment({ issue_number: 1,// github.context.pull_request.number, repositoryOwner, - repositoryName, + repositoryName, checklistContent, }); console.log(github.context); From 006d5317fe18fa36a8eea9b5a9c0024273860932 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:00:08 -0600 Subject: [PATCH 09/16] Test action --- index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 84c48cb..af64102 100644 --- a/index.js +++ b/index.js @@ -13,16 +13,12 @@ const octokit = github.getOctokit(repositoryToken); (async () => { try { - - console.log('owner', repositoryOwner); - console.log('name', repositoryName); - const checklistContent = await fs.readFile(checklistPath, "utf8"); octokit.rest.issues.createComment({ issue_number: 1,// github.context.pull_request.number, - repositoryOwner, - repositoryName, - checklistContent, + owner: repositoryOwner, + repo: repositoryName, + body: checklistContent, }); console.log(github.context); } catch (error) { From 67ba7d75ae338ad2e25095c7474291acae9a8050 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:04:57 -0600 Subject: [PATCH 10/16] Test action --- .github/checklist.md | 6 +++--- index.js | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/checklist.md b/.github/checklist.md index 3e20ceb..3b5de3d 100644 --- a/.github/checklist.md +++ b/.github/checklist.md @@ -1,3 +1,3 @@ -[ ] item 1 -[ ] item 2 -[ ] item 3 \ No newline at end of file +[] item 1 +[] item 2 +[] item 3 \ No newline at end of file diff --git a/index.js b/index.js index af64102..dd81bd3 100644 --- a/index.js +++ b/index.js @@ -7,8 +7,6 @@ const repositoryToken = core.getInput('repository_token'); const repositoryOwner = core.getInput('repository_owner'); const repositoryName = core.getInput('repository_name'); - - const octokit = github.getOctokit(repositoryToken); (async () => { From 4798369055aa1284cd9b64f7ebf9cb104cb56d73 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:10:31 -0600 Subject: [PATCH 11/16] Test action --- .github/checklist.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/checklist.md b/.github/checklist.md index 3b5de3d..c7e025f 100644 --- a/.github/checklist.md +++ b/.github/checklist.md @@ -1,3 +1,3 @@ -[] item 1 -[] item 2 -[] item 3 \ No newline at end of file +- [] item 1 +- [] item 2 +- [] item 3 \ No newline at end of file From 02721d44cdcd640b1c51835fe5577d436e973781 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:11:18 -0600 Subject: [PATCH 12/16] Test action --- .github/checklist.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/checklist.md b/.github/checklist.md index c7e025f..c6f1464 100644 --- a/.github/checklist.md +++ b/.github/checklist.md @@ -1,3 +1,3 @@ -- [] item 1 -- [] item 2 -- [] item 3 \ No newline at end of file +- [ ] item 1 +- [ ] item 2 +- [ ] item 3 \ No newline at end of file From c94f2236ab197877cc2cd87a5c18bf34663bb7ee Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:16:11 -0600 Subject: [PATCH 13/16] Test action --- .github/workflows/test.yml | 5 ++--- action.yml | 11 +---------- index.js | 13 +++++-------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 96e8c03..9f62358 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,8 @@ name: Test on: - push: - branches: - - "**" + pull_request: + types: [opened] jobs: test: diff --git a/action.yml b/action.yml index 8ebf7c9..488e033 100644 --- a/action.yml +++ b/action.yml @@ -5,19 +5,10 @@ inputs: description: 'Path of checklist location relative to the context of files available in the runner' default: "./.github/checklist.md" required: true - repository_token: + github_token: description: "A GitHub token for API access. Defaults to {{ github.token }}." default: "${{ github.token }}" required: true - repository_owner: - description: "The repository owner." - default: "${{ github.repository_owner }}" - required: true - repository_name: - description: "The repository name." - default: "${{ github.event.repository.name }}" - required: true - runs: using: 'node20' main: 'index.js' \ No newline at end of file diff --git a/index.js b/index.js index dd81bd3..868a952 100644 --- a/index.js +++ b/index.js @@ -3,22 +3,19 @@ const fs = require("fs/promises"); const github = require('@actions/github'); const checklistPath = core.getInput('checklist_path'); -const repositoryToken = core.getInput('repository_token'); -const repositoryOwner = core.getInput('repository_owner'); -const repositoryName = core.getInput('repository_name'); +const githubToken = core.getInput('github_token'); -const octokit = github.getOctokit(repositoryToken); +const octokit = github.getOctokit(githubToken); (async () => { try { const checklistContent = await fs.readFile(checklistPath, "utf8"); octokit.rest.issues.createComment({ - issue_number: 1,// github.context.pull_request.number, - owner: repositoryOwner, - repo: repositoryName, + issue_number: github.context.number, + owner: github.context.owner, + repo: github.context.repo, body: checklistContent, }); - console.log(github.context); } catch (error) { console.log(error.message); } From ad72f9fd426fb5e768bbbab7997312adbbafd709 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:28:33 -0600 Subject: [PATCH 14/16] Test action --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 868a952..b05a4cf 100644 --- a/index.js +++ b/index.js @@ -10,10 +10,11 @@ const octokit = github.getOctokit(githubToken); (async () => { try { const checklistContent = await fs.readFile(checklistPath, "utf8"); + console.o octokit.rest.issues.createComment({ issue_number: github.context.number, - owner: github.context.owner, - repo: github.context.repo, + owner: github.context.repo.owner, + repo: github.context.repo.repo, body: checklistContent, }); } catch (error) { From d411517aabae1694df7fa0fb04c1723afda0ea93 Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:30:32 -0600 Subject: [PATCH 15/16] Test action --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b05a4cf..f1875e4 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ const octokit = github.getOctokit(githubToken); const checklistContent = await fs.readFile(checklistPath, "utf8"); console.o octokit.rest.issues.createComment({ - issue_number: github.context.number, + issue_number: github.context.issue.number, owner: github.context.repo.owner, repo: github.context.repo.repo, body: checklistContent, From c946c537fed5cd1ede3285d6b22726e853867c4a Mon Sep 17 00:00:00 2001 From: Roeland Reyniers Date: Wed, 9 Oct 2024 15:43:24 -0600 Subject: [PATCH 16/16] Finalize --- index.js | 1 - package.json | 3 --- 2 files changed, 4 deletions(-) diff --git a/index.js b/index.js index f1875e4..f729a19 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,6 @@ const octokit = github.getOctokit(githubToken); (async () => { try { const checklistContent = await fs.readFile(checklistPath, "utf8"); - console.o octokit.rest.issues.createComment({ issue_number: github.context.issue.number, owner: github.context.repo.owner, diff --git a/package.json b/package.json index b0428db..a79716c 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,6 @@ "version": "1.0.0", "description": "", "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, "keywords": [], "author": "", "license": "ISC",