Skip to content
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
29 changes: 18 additions & 11 deletions .github/workflows/ci-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,25 @@ jobs:
head: `${context.payload.workflow_run.head_repository.full_name}:${context.payload.workflow_run.head_branch}`,
});

if (pullRequest.data.length > 0) {
prNumber = pullRequest.data[0].number;
const prArtifactPath = path.join(process.env.GITHUB_WORKSPACE, '.metrics', 'pr_number', 'pr_number.txt');
if (fs.existsSync(prArtifactPath)) {
prNumber = fs.readFileSync(prArtifactPath, 'utf8').trim();
console.log(`Found PR Number from artifact: ${prNumber}`);
} else {
// Fallback to commit SHA if needed
const commitSha = context.payload.workflow_run.head_sha;
const prsForCommit = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: commitSha,
});
if (prsForCommit.data.length > 0) {
prNumber = prsForCommit.data[0].number;
if (pullRequest.data.length > 0) {
prNumber = pullRequest.data[0].number;
} else {
// Fallback to commit SHA if needed
const commitSha = context.payload.workflow_run.head_sha;
const prsForCommit = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: commitSha,
});
if (prsForCommit.data.length > 0) {
prNumber = prsForCommit.data[0].number;
console.log(`Found PR via commit SHA: #${prNumber}`);
}
}
}

Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/ci-e2e-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,18 @@ jobs:
uses: ./.github/workflows/ci-e2e-opensearch.yml

query:
uses: ./.github/workflows/ci-e2e-query.yml
uses: ./.github/workflows/ci-e2e-query.yml

upload_pr_number:
name: Save and Upload PR Number as Artifact
runs-on: ubuntu-latest
steps:
- name: Save PR number as artifact
if: github.event_name == 'pull_request'
run: echo "${{ github.event.number }}" > pr_number.txt
- name: Upload PR number artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
Loading