Skip to content

Post PBB migration: Refactor "Schedule Friday" workflow #7078

@t-will-gillis

Description

@t-will-gillis

Dependency

Overview

The new Projects Beta is structured a little differently from Projects (classic). During to our recent migration from Projects (classic) to Projects Beta, we scrubbed our workflows and removed all functionality that referenced 'columns' as this term is no longer used. We need to refactor our post migration workflows so that they have similar functionality as previously.

Details

The add-label.js file is part of the "Schedule Friday" workflow. It searches all open issues to check whether the issue assignee has been posting regular updates on the issue, and if not applies a label so to let the team know that the issue is stale. Prior to the Projects Beta migration, add-labels.js searched only those issues in the "In progress (actively working)" column, but this column reference is no longer valid. This file's logic needs to be rewritten in terms of the 'status' field instead, using GraphQL.

Action Items

  • This issue involves GithHub Actions and GraphQL. You will need the new Project Board Beta set up in your repo so that you are able to test and demonstrate your solution. Refer to the "Resources/Instructions" section below to get started, and be sure to let us know if you have questions.
  • Once the Dependency of issue Post PBB migration: Refactor "Issue Trigger"  #7075 is released, there will be three new files in github-actions/utils/- you will need to use two of these on this issue:
    • query-issue-info.js
    • _data/status-field-ids.js
  • In schedule-fri-0700.yml, around line 17 insert after with: :
    github-token: ${{ secrets.HACKFORLA_GRAPHQL_TOKEN }}  
    
  • Leave the other token reference in place. This will be addressed in the future.
  • In add-label.js, refactor the code using GraphQL so that only issues with a 'status' of "In progress (actively working)" are included.
    • Replace:
    for (let issueNum of result) {
      if (issueNum.number) {
        let issueLabels = [];
        for (let label of issueNum.labels) {
          issueLabels.push(label.name);
        }
        if (!issueLabels.some(item => labelsToExclude.includes(item))) {
          issueNums.push(issueNum.number);
        } else {
          console.log(`Excluding Issue #${issueNum.number} because of label`);
        }
      }
    }
    
    with:
    // Filter results; we only want issues in "In progress (actively working)" 
    for (let { number, labels } of result) {
      if (!number) continue;
    
      // Exclude any issues that have excluded labels
      const issueLabels = labels.map(label => label.name);
      if (issueLabels.some(item => labelsToExclude.includes(item))) continue;
    
      // For remaining issues, check if status === "In progress (actively working)"
      const { statusName } = await queryIssueInfo(github, context, number);
      if (statusName === "In progress (actively working)") {
        issueNums.push(number);
      }
    }
    
    • Since we only want to include assigned issues, after line 96 (defining repo), insert:
    assignee: '*',
    
    • On line 88, add Dependency to the labels to exclude
    • Replace the comments around lines 82-86 with:
     /**
     * Finds issue numbers for all open & assigned issues, excluding issues labeled `Draft`, `ER`, `Epic`,
     * or `Dependency`, and returning issue numbers only if their status === "In progess (actively working"
     *
     * @Returns{Array} issueNums   - an array of open, assigned, and statused issue numbers
     */
    
    • On line 36, capitalize GitHub
    • Between lines 3 and 4, insert:
    const statusFieldIds = require('../../utils/_data/status-field-ids');
    const queryIssueInfo = require('../../utils/query-issue-info');
    
  • Test in your own repo to confirm this is working properly

Resources/Instructions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions