Skip to content

[ci] Add GHA workflows to review PRs using Verible #1427

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

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/pr_lint_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: pr-lint-review

on:
workflow_run:
workflows: ["pr-trigger"]
types:
- completed

jobs:
review_triggered:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# this workflow does not run in a PR context
# download 'event.json' file from a PR-tiggered workflow
# to mock the PR context and make a review
- 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 linter action
uses: chipsalliance/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
suggest_fixes: 'false'
config_file: 'vendor/lowrisc_ip/lint/tools/veriblelint/rules.vbl'
25 changes: 25 additions & 0 deletions .github/workflows/pr_trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
name: pr-trigger

on:
pull_request:

jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy event file
run: cp "$GITHUB_EVENT_PATH" ./event.json

# If this workflow is triggered by a PR from a fork
# it won't have sufficient access rights to make a review
# so we just save the file needed to do the review
# in a context with proper access rights
- name: Upload event file as artifact
uses: actions/upload-artifact@v2
with:
name: event.json
path: event.json