html-preview-action
html-preview-action copied to clipboard
What is the file/info needed here?
What is the file/info needed here? I dont know if my container has it.
Can I see the workflow file?
It is on a private repo, I am afraid that I can't share it. But I can add this.
It is a test, to see if I can share the artifacts of a PCB board verification. This step compares boards by generating a bunch of diff images. The tool that is being used also generates an HTML to make this review process easier.
So, I can share artifacts, but now they are not that good since the Github makes a package of them when the user is going to download. Even if it is a single file.
I thought that by using your action I could make these output being visible by an URL that can speed up the review process.
DiffPCB:
name: PCB Diffs
runs-on: ubuntu-latest
container: leoheck/kicad_auto:latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Workaround because init private submodules is failing now...
- name: Donwload Library Manually
shell: bash
run: |
cd pcb
rm -rf library
wget https://www.dropbox.com/s/8flbkkltrgqzn8h/library.tgz?dl=0 -O library.tgz
tar xvzf library.tgz
rm -rf library.tgz
- name: Generate PCB Diffs
run: |
cd pcb
commit_base=$(git reflog show | tail -1 | cut -d" " -f1)
last_commit=$(git reflog show | head -1 | cut -d" " -f1)
echo "commit_base: $commit_base"
echo "last_commit: $last_commit"
[ -f *.kicad_pcb ] && kidiff_linux.py board.kicad_pcb --scm Git -w -a $commit_base -b $last_commit
# This is an workaroun to tryiung to solve the issue described before (it didnt work)
- name: Workaround to run HTML preview
shell: bash
run: |
touch /etc/os-release
echo 'NAME="Ubuntu"' | tee -a /etc/os-release
echo 'VERSION="20.04 LTS (Focal Fossa)"' | tee -a /etc/os-release
echo 'ID=ubuntu' | tee -a /etc/os-release
echo 'ID_LIKE=debian' | tee -a /etc/os-release
echo 'PRETTY_NAME="Ubuntu 20.04 LTS"' | tee -a /etc/os-release
echo 'VERSION_ID="20.04"' | tee -a /etc/os-release
echo 'HOME_URL="https://www.ubuntu.com/"' | tee -a /etc/os-release
echo 'SUPPORT_URL="https://help.ubuntu.com/"' | tee -a /etc/os-release
echo 'BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"' | tee -a /etc/os-release
echo 'PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"' | tee -a /etc/os-release
echo 'VERSION_CODENAME=focal' | tee -a /etc/os-release
echo 'UBUNTU_CODENAME=focal' | tee -a /etc/os-release
touch /etc/lsb-release
echo DISTRIB_ID=Ubuntu | tee -a /etc/lsb-release
echo DISTRIB_RELEASE=20.04 | tee -a /etc/lsb-release
echo DISTRIB_CODENAME=focal | tee -a /etc/lsb-release
echo DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS" | tee -a /etc/lsb-release
echo "============================"
cat /etc/*release | grep ^ID
echo "============================"
- name: HTML Preview
uses: pavi2410/html-preview-action@master
with:
msg: 'PCB Diffs URL'
html_file: 'pcb/plots/web/index.html'
gh_token: ${{ secrets.CI_PAT }}
I got the last part from the README of this repo.
This plots/web/index.html is being generated here in this step Generate PCB Diffs
Now I am seeing this
HTML Preview1s
gh_token: ***
Run pavi2410/html-preview-action@master
with:
msg: PCB Diffs URL
html_file: pcb/plots/web/index.html
gh_token: ***
/usr/bin/docker exec 551881d242300c0853ed0ffe05b7b62087e3225dfcbe65e420ae9723f0a95f8e sh -c "cat /etc/*release | grep ^ID"
##[error]Cannot read property 'number' of undefined
I have no idea where the error is. These kinds of errors are not descriptive at all.
Maybe what is missing is to se the right permissions. What should I select from this list to have access to delpoy the HTML?

Cannot read property 'number' of undefined
Looks like it is not able to read PR number.
Are you sure it is triggered from a PR?
Also, there is a Github Action issue that prevents forks from triggering actions.
It is a PR but now it was triggered by a simple push. Does it need to be a PR?
Yes, it is assumed that this action is triggered by a PR. However, you can modify the JS file to customise the Action.
https://www.github.com/pavi2410/html-preview-action/tree/master/index.js
Give me a few days, I make it to return the URL as the output of the Action instead of commenting on a PR, so that you can use the URL however you want.
I released v2: https://github.com/pavi2410/html-preview-action/releases/tag/v2
Wow, you are pretty fast. I will give it a try and report my results in some hours. I just have to go to the supermarket first!
Why did you remove the msg? I was interested in that? Is this related to the issue I was facing to make it work?
The msg input was just providing the title for the link to be written in the comment. Now, the link can be used any way you like.
If you want to comment something on a PR, look for an Action which does that.
I like the link title, this was not the issue.
The issue is that it is not working for me, for some reason. It is probable that I am doing something wrong, maybe with the pr/push style like you said. Or it can be the authentication part since my repo is private.
Do you mind adding more info about the setup process on the README so I can double-check if I am doing everything right?