[go: nahoru, domu]

Skip to content
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

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

Open
13 tasks
Tracked by #6993 ...
t-will-gillis opened this issue Jun 28, 2024 · 2 comments
Open
13 tasks
Tracked by #6993 ...

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

t-will-gillis opened this issue Jun 28, 2024 · 2 comments
Labels
Complexity: Large Dependency An issue is blocking the completion or starting of another issue Feature: API Coding requires using an API Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 5pt Can be done in 19-30 hours

Comments

@t-will-gillis
Copy link
Member
t-will-gillis commented Jun 28, 2024

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

@t-will-gillis t-will-gillis added role: back end/devOps Tasks for back-end developers Complexity: Large Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 5pt Can be done in 19-30 hours Feature: API Coding requires using an API labels Jun 28, 2024
@t-will-gillis t-will-gillis added Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly Draft Issue is still in the process of being created labels Jun 28, 2024
@t-will-gillis t-will-gillis self-assigned this Jun 28, 2024

This comment was marked as outdated.

@t-will-gillis

This comment was marked as resolved.

@t-will-gillis t-will-gillis reopened this Jul 15, 2024
@t-will-gillis t-will-gillis added Dependency An issue is blocking the completion or starting of another issue and removed Draft Issue is still in the process of being created labels Jul 21, 2024
@t-will-gillis t-will-gillis removed their assignment Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Large Dependency An issue is blocking the completion or starting of another issue Feature: API Coding requires using an API Feature: Board/GitHub Maintenance Project board maintenance that we have to do repeatedly Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 5pt Can be done in 19-30 hours
Projects
Development

No branches or pull requests

1 participant