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
47 changes: 44 additions & 3 deletions add-to-project/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
# Copyright (c) 2025-2026, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,12 +19,53 @@ inputs:
description: "GitHub token"
required: true
type: string
project-url:
description: "GitHub project URL"
required: false
default: 'https://github.com/orgs/NVIDIA/projects/4'

runs:
using: "composite"
steps:
- name: Adding to project
uses: actions/add-to-project@v1.0.2
uses: actions/github-script@v8
env:
PROJECT_URL: ${{ inputs.project-url }}
with:
project-url: https://github.com/orgs/NVIDIA/projects/4
github-token: ${{ inputs.token }}
script: |
const projectUrl = process.env.PROJECT_URL;
const match = projectUrl.match(/\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/);
if (!match) {
core.setFailed(`Invalid project URL: ${projectUrl}`);
return;
}
const { ownerType, ownerName, projectNumber } = match.groups;

// Get the project node ID
const ownerField = ownerType === 'orgs' ? 'organization' : 'user';
const { [ownerField]: owner } = await github.graphql(`
query($ownerName: String!, $projectNumber: Int!) {
${ownerField}(login: $ownerName) {
projectV2(number: $projectNumber) { id }
}
}
`, { ownerName, projectNumber: parseInt(projectNumber) });
const projectId = owner.projectV2.id;
Comment thread
pxLi marked this conversation as resolved.

// Get the content node ID (issue or pull request)
const contentId = context.payload.issue?.node_id || context.payload.pull_request?.node_id;
if (!contentId) {
core.setFailed('No issue or pull request found in event payload.');
return;
}

await github.graphql(`
mutation($projectId: ID!, $contentId: ID!) {
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) {
item { id }
}
}
`, { projectId, contentId });

core.info(`Added to project ${projectUrl}`);
4 changes: 2 additions & 2 deletions checkout/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
# Copyright (c) 2025-2026, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -95,7 +95,7 @@ runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
Comment thread
pxLi marked this conversation as resolved.
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
Expand Down
2 changes: 1 addition & 1 deletion pr-description-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
using: "composite"
steps:
- name: Check PR description and checklist
uses: actions/github-script@v7
uses: actions/github-script@v8
env:
TEMPLATE_PATH: ${{ inputs.template-path }}
with:
Expand Down
Loading