diff --git a/.github/workflows/updload_artifacts.yml b/.github/workflows/updload_artifacts.yml index 152d61c..ec2a4d5 100644 --- a/.github/workflows/updload_artifacts.yml +++ b/.github/workflows/updload_artifacts.yml @@ -35,10 +35,35 @@ jobs: echo "The workflow run name is: ${{ github.run_id }}" - - name: Get PR Number + - name: Get PR Number 1 # if: github.event.workflow_run.pull_requests != '' run: | - echo " pr num: ${{ github.event.workflow_run.event.number }}" + pr_number=$(echo "${{ toJson(github.event.workflow_run.pull_requests) }}" | jq '.[0].number') + echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV + echo "The workflow run URL is: $GITHUB_RUN_URL" + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Get Pull Request Number - 2 + id: get_pr + run: | + pr=$(gh pr list --head ${{ github.event.workflow_run.head_branch }} --state open --json number --jq '.[0].number') + echo "PR_NUMBER=$pr" >> $GITHUB_ENV + echo "pr num is: $pr" + + - name: Add a comment to the PR + if: env.PR_NUMBER != '' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.issues.createComment({ + issue_number: process.env.PR_NUMBER, + owner: context.repo.owner, + repo: context.repo.repo, + body: "This is a comment added by the workflow." + }) - name: Authenticate with GCS uses: "google-github-actions/auth@v2"