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

Changed how prettier comments on PR works #2112

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
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
43 changes: 43 additions & 0 deletions .github/workflows/prettier-comment-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Comment on pull request

on:
workflow_run:
workflows: [Prettier code formatter]
types:
- completed

jobs:
comment:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: Download artifact
uses: actions/github-script@v7
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 == "HTML Diff"
})[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}}/HTML Diff.zip', Buffer.from(download.data));
- name: Unzip artifact
run: unzip HTML\ Diff.zip
- name: PR comment with html diff
# https://docs.github.com/en/actions/learn-github-actions/expressions#failure-with-conditions
uses: thollander/actions-comment-pull-request@v2
with:
filePath: diff.html
40 changes: 0 additions & 40 deletions .github/workflows/prettier-on-pr.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Prettier code formatter (Push)
name: Prettier code formatter

on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main
workflow_dispatch:

jobs:
check:
Expand Down