From 2f9fa990245d1e166c4a72d4bc73e7074cc48913 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 24 Sep 2024 10:46:31 -0400 Subject: [PATCH] Try v 7 --- .../workflows/github-actions-comment-test.yml | 42 ++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/.github/workflows/github-actions-comment-test.yml b/.github/workflows/github-actions-comment-test.yml index e1da1a1ec9..927e2c11bd 100644 --- a/.github/workflows/github-actions-comment-test.yml +++ b/.github/workflows/github-actions-comment-test.yml @@ -5,39 +5,15 @@ on: types: [opened, synchronize] jobs: - add-comment: + comment: runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Test - uses: actions/github-script@0.3.0 - id: get_issue_number + - uses: actions/github-script@v7 with: - script: | - if (context.issue.number) { - // Return issue number if present - return context.issue.number; - } else { - // Otherwise return issue number from commit - return ( - await github.rest.repos.listPullRequestsAssociatedWithCommit({ - commit_sha: context.sha, - owner: context.repo.owner, - repo: context.repo.repo, - }) - ).data[0].number; - } - result-encoding: string - - name: Issue number - run: echo '${{steps.get_issue_number.outputs.result}}' - - name: Leave PR comment - env: - PR_NUMBER: ${{ steps.get_issue_number.outputs.result }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - curl -H "Authorization: token ${GITHUB_TOKEN}" \ - -X POST \ - -d '{"body": "🎉 Congratulations "}' \ - "https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Context test' + })