Skip to content

Commit

Permalink
Try using Merlinoi's PAT to send a PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
pitag-ha committed Dec 7, 2023
1 parent eca61bb commit 83a4f32
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/fuzzy-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <<EOF
Hello :)
EOF
)
jq -n --arg msg "$msg" '{ body: $msg }' | tee -a body.json
- name: Ls
run: ls -la
- name: Write comment on PR
run: |
curl -LsX POST -H "Authorization: Bearer $TOKEN" -d @body.json "$GH_API_COMMENTS"
echo $?
# data:
# name: Generate data
# runs-on: ubuntu-22.04
Expand Down

0 comments on commit 83a4f32

Please sign in to comment.