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
2 changes: 1 addition & 1 deletion .github/workflows/.release-created.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
${{ startsWith(github.ref, 'refs/heads/release/') }}
steps:
# Checks-out the develop branch
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
ref: 'refs/heads/develop'

Expand Down
55 changes: 33 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ jobs:
name: Build, Test, Verify, Publish
# The type of runner that the job will run on
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.versioning.outputs.new_version }}
steps:
#########################################################################
# Environment Setup
#########################################################################
# NOTE: This step is platform-specific
# Checks out this repository and sets up the build/test environment with
# gradle
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.12'
Expand Down Expand Up @@ -66,6 +68,7 @@ jobs:
fi

echo "new_version=${new_version}" >> $GITHUB_ENV
echo "new_version=${new_version}" >> $GITHUB_OUTPUT

- name: Override Environment for Deploy Command
if: contains(github.event.head_commit.message, '/deploy')
Expand Down Expand Up @@ -171,35 +174,43 @@ jobs:
git push origin "${VERSION}"


#########################################################################
# Publish release to releases
#########################################################################
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*.whl

release-zip:
name: Create Zip Release
runs-on: ubuntu-24.04-arm
needs: build
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
steps:
- uses: actions/checkout@v7
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: python-dist
path: dist

- name: Create Zip release
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
run: |
poetry run pip install -t package dist/*.whl
python -m pip install -t package dist/*.whl
cd package/; zip -r ../terraform/postworkflow-normalizer.zip . -x '*.pyc'
cd ../; cd terraform; zip -r ../postworkflow-normalizer-${{ env.new_version }}.zip *
cd ../; cd terraform; zip -r ../postworkflow-normalizer-${{ needs.build.outputs.new_version }}.zip *

- name: Upload Release Artifacts
if: |
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release') ||
github.event.head_commit.message == '/deploy sit' ||
github.event.head_commit.message == '/deploy uat' ||
github.event.head_commit.message == '/deploy sandbox'
uses: ncipollo/release-action@v1.14.0
with:
tag: ${{ env.new_version }}
tag: ${{ needs.build.outputs.new_version }}
artifacts: "*.zip"
token: ${{ secrets.GITHUB_TOKEN }}
body: "Version ${{ env.new_version }}"
body: "Version ${{ needs.build.outputs.new_version }}"
makeLatest: "${{ github.ref == 'refs/heads/main' }}"
prerelease: "${{ github.ref != 'refs/heads/main' }}"
129 changes: 129 additions & 0 deletions .github/workflows/org-add-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# used to triage new issues and PRs on project board, so not to miss external feedback or contributions of users.
name: Add to PODAAC Project


on:
issues:
types: [opened]
pull_request:
types: [opened]

jobs:
add-to-project:
runs-on: ubuntu-latest
steps:
- name: Add to project
uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/podaac/projects/75
github-token: ${{ secrets.PROJECTS_PAT }}

- name: Set status to needs:triage
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PROJECTS_PAT }}
script: |
const projectNumber = 75; // Update this with your actual project number
const org = 'podaac';

// Get the project ID
const projectQuery = `
query($org: String!, $number: Int!) {
organization(login: $org) {
projectV2(number: $number) {
id
fields(first: 20) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}
`;

const projectData = await github.graphql(projectQuery, {
org: org,
number: projectNumber
});

const project = projectData.organization.projectV2;
const statusField = project.fields.nodes.find(field => field.name === 'Status');
const triageOption = statusField?.options.find(option => option.name === 'needs:triage');

if (!triageOption) {
core.warning('Could not find "needs:triage" status option');
return;
}

// Get the item ID that was just added
const itemType = context.eventName === 'issues' ? 'Issue' : 'PullRequest';
const itemNumber = context.payload.issue?.number || context.payload.pull_request?.number;

const itemQuery = `
query($org: String!, $repo: String!, $number: Int!) {
repository(owner: $org, name: $repo) {
${itemType === 'Issue' ? 'issue' : 'pullRequest'}(number: $number) {
projectItems(first: 10) {
nodes {
id
project {
id
}
}
}
}
}
}
`;

const itemData = await github.graphql(itemQuery, {
org: org,
repo: context.repo.repo,
number: itemNumber
});

const items = itemType === 'Issue'
? itemData.repository.issue.projectItems.nodes
: itemData.repository.pullRequest.projectItems.nodes;

const projectItem = items.find(item => item.project.id === project.id);

if (!projectItem) {
core.warning('Could not find project item');
return;
}

// Update the status field
const updateMutation = `
mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $value: String!) {
updateProjectV2ItemFieldValue(
input: {
projectId: $projectId
itemId: $itemId
fieldId: $fieldId
value: { singleSelectOptionId: $value }
}
) {
projectV2Item {
id
}
}
}
`;

await github.graphql(updateMutation, {
projectId: project.id,
itemId: projectItem.id,
fieldId: statusField.id,
value: triageOption.id
});

core.info('Successfully set status to needs:triage');
127 changes: 127 additions & 0 deletions .github/workflows/org-close-pr-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Directly move the closed PR to a close status in the PODAAC project
# to avoid unnecessary clutter and manual triage in the "needs:triage" column.
name: Update Closed PR Status in PODAAC project

on:
pull_request:
types: [closed]

jobs:
update-pr-status:
runs-on: ubuntu-latest
steps:
- name: Set status to closed
uses: actions/github-script@v7
with:
github-token: ${{ secrets.PROJECTS_PAT }}
script: |
const projectNumber = 75;
const org = 'podaac';
const prNumber = context.payload.pull_request.number;
const isMerged = context.payload.pull_request.merged;

console.log(`PR #${prNumber} was ${isMerged ? 'merged' : 'closed without merging'}`);

// Get the project ID and status field information
const projectQuery = `
query($org: String!, $number: Int!) {
organization(login: $org) {
projectV2(number: $number) {
id
fields(first: 20) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}
`;

const projectData = await github.graphql(projectQuery, {
org: org,
number: projectNumber
});

const project = projectData.organization.projectV2;
const statusField = project.fields.nodes.find(field => field.name === 'Status');
const closedOption = statusField?.options.find(option => option.name === 'closed');

if (!closedOption) {
core.warning('Could not find "closed" status option in project');
return;
}

// Get the PR's project item
const itemQuery = `
query($org: String!, $repo: String!, $number: Int!) {
repository(owner: $org, name: $repo) {
pullRequest(number: $number) {
projectItems(first: 10) {
nodes {
id
project {
id
}
}
}
}
}
}
`;

const itemData = await github.graphql(itemQuery, {
org: org,
repo: context.repo.repo,
number: prNumber
});

const items = itemData.repository.pullRequest.projectItems.nodes;
const projectItem = items.find(item => item.project.id === project.id);

if (!projectItem) {
console.log('PR is not in the project, skipping status update');
return;
}

// Update the status field to "closed"
const updateMutation = `
mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $value: String!) {
updateProjectV2ItemFieldValue(
input: {
projectId: $projectId
itemId: $itemId
fieldId: $fieldId
value: { singleSelectOptionId: $value }
}
) {
projectV2Item {
id
}
}
}
`;

await github.graphql(updateMutation, {
projectId: project.id,
itemId: projectItem.id,
fieldId: statusField.id,
value: closedOption.id
});

console.log(`✅ Successfully set status to "closed" for PR #${prNumber}`);

core.summary
.addHeading(`PR Status Updated`)
.addList([
`PR #${prNumber} was ${isMerged ? 'merged' : 'closed'}`,
`Project status updated to "closed"`
])
.write();
Loading
Loading