Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the file/info needed here? #9

Open
leoheck opened this issue Jun 5, 2020 · 13 comments
Open

What is the file/info needed here? #9

leoheck opened this issue Jun 5, 2020 · 13 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@leoheck
Copy link

leoheck commented Jun 5, 2020

image
What is the file/info needed here? I dont know if my container has it.

@pavi2410
Copy link
Owner

pavi2410 commented Jun 6, 2020

Can I see the workflow file?

@leoheck
Copy link
Author

leoheck commented Jun 6, 2020

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

@leoheck
Copy link
Author

leoheck commented Jun 6, 2020

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.

@leoheck
Copy link
Author

leoheck commented Jun 7, 2020

Maybe what is missing is to se the right permissions.
What should I select from this list to have access to delpoy the HTML?

image

@pavi2410
Copy link
Owner

pavi2410 commented Jun 7, 2020

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.

@leoheck
Copy link
Author

leoheck commented Jun 7, 2020

It is a PR but now it was triggered by a simple push.
Does it need to be a PR?

@pavi2410
Copy link
Owner

pavi2410 commented Jun 7, 2020

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

@pavi2410
Copy link
Owner

pavi2410 commented Jun 7, 2020

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.

@pavi2410
Copy link
Owner

pavi2410 commented Jun 7, 2020

@pavi2410 pavi2410 self-assigned this Jun 7, 2020
@pavi2410 pavi2410 added bug Something isn't working enhancement New feature or request labels Jun 7, 2020
@leoheck
Copy link
Author

leoheck commented Jun 7, 2020

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!

@leoheck
Copy link
Author

leoheck commented Jun 7, 2020

Why did you remove the msg? I was interested in that? Is this related to the issue I was facing to make it work?

@pavi2410
Copy link
Owner

pavi2410 commented Jun 8, 2020

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.

@leoheck
Copy link
Author

leoheck commented Jun 9, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants