From 83a4f32a9da8782b8a6039cc76248f6268f4c62c Mon Sep 17 00:00:00 2001 From: Sonja Heinze Date: Thu, 7 Dec 2023 17:04:00 +0100 Subject: [PATCH] Try using Merlinoi's PAT to send a PR comment --- .github/workflows/fuzzy-ci.yml | 43 +++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/.github/workflows/fuzzy-ci.yml b/.github/workflows/fuzzy-ci.yml index 9edf32548c..a9f22728ff 100644 --- a/.github/workflows/fuzzy-ci.yml +++ b/.github/workflows/fuzzy-ci.yml @@ -33,7 +33,7 @@ env: GH_API_COMMENTS: ${{ github.event.pull_request.comments_url }} GH_API_LABELS: ${{ github.event.pull_request.issue_url }}/labels GH_API_ARTIFACTS: ${{ github.event.pull_request.base.repo.url }}/actions/artifacts - TOKEN: ${{ secrets.GITHUB_TOKEN }} + TOKEN: ${{ secrets.MERLINOIS_PAT }} # URL short-hands ACTIONS_RUNS_ENDPOINT: ${{ github.event.repository.html_url }}/actions/runs @@ -47,29 +47,40 @@ env: # The compiler version used on master. It also needs to form part of Irmin's build cache key. Bump this on other branches and whenever the compiler version on master is bumped. COMPILER_VERSION: ocaml-base-compiler.4.14.1 + jobs: - artifact-check: - name: Trying to download an artifact only with pull-request read permissions - # permissions: - # pull-requests: write + write-comment: + name: Try writing a comment on the PR using a PAT runs-on: ubuntu-22.04 steps: - - name: Download artifact + - name: Debug if TOKEN exists run: | - curl -sSLO -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$GH_API_ARTIFACTS/1091179282/zip" -D headers.txt - - - name: Print headers - run: cat headers.txt + if [ -z $TOKEN ]; then + echo "TOKEN is empty" + else + echo "TOKEN exists." + fi - - name: Ls - run: ls -la + - name: Debug if secret exists + run: | + if [ -z ${{ secrets.MERLINOIS_PAT }} ]; then + echo "secret is empty" + else + echo "secret exists." + fi - - name: Unzip downloaded artifact + - name: Write HTTP body to file run: | - unzip zip || (echo "Download of artifact failed" && cat headers.txt && cat zip && exit 1) + msg=$( cat <