Skip to content

Resyntax Review Submission #47

Resyntax Review Submission

Resyntax Review Submission #47

name: Resyntax Review Submission
# The Resyntax integration is split into two workflows. See ./resyntax-analyze.yml for details about
# why it works this way.
on:
workflow_run:
workflows: ["Resyntax Analysis"]
types:
- completed
jobs:
review:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Download Resyntax analysis
# This uses a github script instead of the download-artifact action because
# that action doesn't work for artifacts uploaded by other workflows. See
# https://github.com/actions/download-artifact/issues/130 for more info.
uses: actions/[email protected]
with:
script: |
var artifacts = await github.rest.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 == "resyntax-review"
})[0];
var download = await github.rest.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}}/resyntax-review.zip', Buffer.from(download.data));
- run: unzip resyntax-review.zip
- name: Create pull request review
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var create_review_request = require('./resyntax-review.json');
await github.rest.pulls.createReview(create_review_request);