Coder Social home page Coder Social logo

verible-formatter-action's Introduction

Verible Formatter Action

Usage

See action.yml

This is a GitHub Action used to format Verilog and SystemVerilog source files and create change suggestions in Pull Requests automatically. The GitHub Token input is used to provide reviewdog access to the PR.

Here's a basic example to format all *.v and *.sv files:

name: Verible formatter example
on:
  pull_request:
jobs:
  format:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: chipsalliance/verible-format-action@main
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}

You can provide paths argument to point files to format. Directories will be searched recursively for *.v and *.sv files. paths defaults to '.'.

- uses: chipsalliance/verible-format-action@main
  with:
    paths: |
      ./rtl
      ./shared
    github_token: ${{ secrets.GITHUB_TOKEN }}

Automatic review on PRs from external repositories

In GitHub Actions, workflows triggered by external repositories may only have read access to the main repository. In order to have automatic reviews on external PRs, you need to create two workflows. One will be triggered on pull_request and upload the data needed by reviewdog as an artifact. The artifact shall store the file pointed by $GITHUB_EVENT_PATH as event.json. The other workflow will download the artifact and use the Verible action.

For example:

name: upload-event-file
on:
  pull_request:

...
      - run: cp "$GITHUB_EVENT_PATH" ./event.json
      - name: Upload event file as artifact
        uses: actions/upload-artifact@v2
        with:
          name: event.json
          path: event.json
name: review-triggered
on:
  workflow_run:
    workflows: ["upload-event-file"]
    types:
      - completed

jobs:
  review_triggered:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: 'Download artifact'
        id: get-artifacts
        uses: actions/[email protected]
        with:
          script: |
            var artifacts = await github.actions.listWorkflowRunArtifacts({
               owner: context.repo.owner,
               repo: context.repo.repo,
               run_id: ${{github.event.workflow_run.id }},
            });
            var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
              return artifact.name == "event.json"
            })[0];
            var download = await github.actions.downloadArtifact({
               owner: context.repo.owner,
               repo: context.repo.repo,
               artifact_id: matchArtifact.id,
               archive_format: 'zip',
            });
            var fs = require('fs');
            fs.writeFileSync('${{github.workspace}}/event.json.zip', Buffer.from(download.data));
      - run: |
          unzip event.json.zip
      - name: Run Verible formatter action
        uses: chipsalliance/verible-formatter-action@main
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

verible-formatter-action's People

Contributors

tgorochowik avatar wsipak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.