Skip to content

PHAR prefix diff workflow #4044

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 11 commits into from
Jun 4, 2025
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
2 changes: 2 additions & 0 deletions .github/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
63 changes: 63 additions & 0 deletions .github/scripts/find-artifact.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import * as core from "@actions/core";
import * as github from "@actions/github";

interface Inputs {
github: ReturnType<typeof github.getOctokit>;
context: typeof github.context;
core: typeof core;
}

module.exports = async ({github, context, core}: Inputs) => {
const commitSha = process.env.BASE_SHA;
const artifactName = process.env.ARTIFACT_NAME;
const workflowName = process.env.WORKFLOW_NAME;

// Get all workflow runs for this commit
const runs = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 20,
event: "push",
head_sha: commitSha
});

if (runs.data.workflow_runs.length === 0) {
core.setFailed(`No workflow runs found for commit ${commitSha}`);
return;
}

const workflowRuns = runs.data.workflow_runs;
if (workflowRuns.length === 0) {
core.setFailed(`No workflow runs found for commit ${commitSha}`);
return;
}

let found = false;
for (const run of workflowRuns) {
if (run.status !== "completed" || run.conclusion !== "success") {
continue;
}

if (run.name !== workflowName) {
continue;
}

const artifactsResp = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id,
});

const artifact = artifactsResp.data.artifacts.find(a => a.name === artifactName);
if (artifact) {
core.setOutput("artifact_id", artifact.id.toString());
core.setOutput("run_id", run.id.toString());
found = true;
break;
}
}

if (!found) {
core.setFailed(`No artifact named '${artifactName}' found for commit ${commitSha}`);
}
}
32 changes: 32 additions & 0 deletions .github/scripts/listPrefix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php declare(strict_types = 1);

require_once __DIR__ . '/../../vendor/autoload.php';

$dir = $argv[1] ?? __DIR__;
$iterator = new RecursiveDirectoryIterator($dir);
$iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($iterator);

$locations = [];
foreach ($files as $file) {
$path = $file->getPathname();
if ($file->getExtension() !== 'php') {
continue;
}
$contents = file_get_contents($path);
$lines = explode("\n", $contents);
foreach ($lines as $i => $line) {
if (!str_contains($line, '_PHPStan_checksum')) {
continue;
}

$trimmedPath = substr($path, strlen($dir) + 1);
if (str_starts_with($trimmedPath, 'vendor/composer/autoload_')) {
continue;
}
$locations[] = $trimmedPath . ':' . ($i + 1);
}
}
sort($locations);
echo implode("\n", $locations);
echo "\n";
Loading
Loading