Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
43c410d
Add logs
andershagbard Nov 12, 2024
227d763
Update
andershagbard Nov 12, 2024
ac1d454
Update
andershagbard Nov 12, 2024
f3b65d6
Update
andershagbard Nov 12, 2024
cbc7ec7
Update
andershagbard Nov 12, 2024
4254135
Fix
andershagbard Nov 12, 2024
f026bd3
Update
andershagbard Nov 12, 2024
e55f861
Update
andershagbard Nov 12, 2024
4b08459
Update
andershagbard Nov 12, 2024
af07df8
UPDATE
andershagbard Nov 12, 2024
0f29a1b
Update
andershagbard Nov 12, 2024
ca65bad
Update
andershagbard Nov 12, 2024
d477157
Fix
andershagbard Nov 12, 2024
a1df2d1
Revert
andershagbard Nov 12, 2024
c9a27da
Test
andershagbard Nov 12, 2024
dfbeaec
Update
andershagbard Nov 12, 2024
c5a2ac1
Update
andershagbard Nov 13, 2024
6874ff3
Add prettier
andershagbard Nov 13, 2024
de89a97
Update index.js
andershagbard Nov 13, 2024
4b31d3a
Update
andershagbard Nov 13, 2024
16d8acc
Merge pull request #1 from andershagbard/log-test
andershagbard Nov 13, 2024
d20e7d3
Minimize runs
andershagbard Nov 13, 2024
c57a28a
Update addAnnotations.ts
andershagbard Nov 13, 2024
3f8ae4c
Run build
andershagbard Nov 13, 2024
ccbc451
Revert prettier
andershagbard Jun 15, 2025
4ea51f2
Revert more
andershagbard Jun 15, 2025
99115f8
Revert more
andershagbard Jun 15, 2025
c40b7be
More revert
andershagbard Jun 15, 2025
4482f26
Revert
andershagbard Jun 15, 2025
26cbb4c
Update packages
andershagbard Jun 15, 2025
cbc9585
Revert "Update packages"
andershagbard Jun 15, 2025
158ba41
Revert packages
andershagbard Jun 15, 2025
85a1423
Revert more
andershagbard Jun 15, 2025
01123fb
Revert
andershagbard Jun 15, 2025
486431f
Update yarn.lock
andershagbard Jun 15, 2025
8492181
Build file
andershagbard Jun 15, 2025
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
10 changes: 5 additions & 5 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"step:config": "scripts/run-step getConfigContents"
},
"devDependencies": {
"@octokit/webhooks-types": "^7.6.1",
"@types/common-tags": "^1.8.1",
"@types/node": "10.17.60",
"@types/semver": "^7.5.6",
Expand Down
23 changes: 9 additions & 14 deletions src/addAnnotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { GitHub, getOctokitOptions } from '@actions/github/lib/utils';
import { throttling } from '@octokit/plugin-throttling';
import { Context } from '@actions/github/lib/context';
import { Octokit } from '@octokit/rest';
import type { PullRequestEvent } from '@octokit/webhooks-types';
import { stripIndent as markdown } from 'common-tags';
import { ThemeCheckReport, ThemeCheckOffense } from './types';
import * as path from 'path';
Expand Down Expand Up @@ -79,7 +80,6 @@ export async function addAnnotations(
const themeRoot = core.getInput('theme_root');
const version = core.getInput('version');
const flags = core.getInput('flags');

const octokit = new ThrottledOctokit({
...getOctokitOptions(ghToken),
throttle: {
Expand Down Expand Up @@ -113,28 +113,26 @@ export async function addAnnotations(

console.log('Creating GitHub check...');

const root = path.resolve(cwd, themeRoot);

const result: ThemeCheckReport[] = reports.filter(
getDiffFilter(
root,
path.resolve(cwd, themeRoot),
fileDiff?.map((x) => path.join(cwd, x)),
),
);

// Create check
const prPayload = github.context.payload as PullRequestEvent
const check = await octokit.rest.checks.create({
owner: ctx.repo.owner,
repo: ctx.repo.repo,
...ctx.repo,
name: CHECK_NAME,
head_sha: ctx.sha,
head_sha: github.context.eventName == 'pull_request' ? prPayload.pull_request.head.sha : github.context.sha,
status: 'in_progress',
});

const allAnnotations: GitHubAnnotation[] = result
.flatMap((report: ThemeCheckReport) =>
.flatMap((report) =>
report.offenses.map((offense) => ({
path: path.relative(root, path.resolve(report.path)),
path: path.relative(cwd, path.resolve(report.path)),
Copy link
Contributor

@aswamy aswamy Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not from the root anymore?

Copy link
Contributor Author

@andershagbard andershagbard Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was because the Shopify files are not necessarily in the root of the repo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. might have diff root, so src/snippets/foo.liquid instead of snippets/foo.liquid? Could be useful for multi-root setups, 👍

start_line: offense.start_row + 1,
end_line: offense.end_row + 1,
start_column:
Expand Down Expand Up @@ -181,8 +179,7 @@ export async function addAnnotations(
await Promise.all(
annotationsChunks.map(async (annotations) =>
octokit.rest.checks.update({
owner: ctx.repo.owner,
repo: ctx.repo.repo,
...ctx.repo,
check_run_id: check.data.id,
output: {
title: CHECK_NAME,
Expand All @@ -195,11 +192,9 @@ export async function addAnnotations(

// Add final report
await octokit.rest.checks.update({
owner: ctx.repo.owner,
repo: ctx.repo.repo,
...ctx.repo,
check_run_id: check.data.id,
name: CHECK_NAME,
status: 'completed',
conclusion: exitCode > 0 ? 'failure' : 'success',
output: {
title: CHECK_NAME,
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@
dependencies:
"@octokit/openapi-types" "^12.11.0"

"@octokit/webhooks-types@^7.6.1":
version "7.6.1"
resolved "https://registry.yarnpkg.com/@octokit/webhooks-types/-/webhooks-types-7.6.1.tgz#bc96371057c2d54c982c9f8f642655b26cd588eb"
integrity sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw==

"@tsconfig/node10@^1.0.7":
version "1.0.9"
resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2"
Expand Down