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

Fix bug and consolidate "Schedule Thursday" into "Schedule Monthly" 4788 #5467

Merged
merged 37 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a36c11d
Update schedule-monthly.yml
t-will-gillis Sep 9, 2023
6354f0c
Update contributors-data.js
t-will-gillis Sep 9, 2023
fa8230e
Update create-new-issue.js
t-will-gillis Sep 9, 2023
62afa80
Update comment-issue.js
t-will-gillis Sep 9, 2023
35d92d1
Update create-new-issue.js
t-will-gillis Sep 9, 2023
14fe8d7
Delete github-actions/trigger-schedule/list-inactive-members/get-list.js
t-will-gillis Sep 9, 2023
d224138
Delete .github/workflows/schedule-monthly-PREV.yml
t-will-gillis Sep 9, 2023
f703c75
Update create-new-issue.js
t-will-gillis Sep 12, 2023
0d5ace4
Update create-new-issue.js
t-will-gillis Sep 22, 2023
e72113d
Update create-new-issue.js
t-will-gillis Oct 22, 2023
96cbc39
Update schedule-monthly.yml
t-will-gillis Oct 30, 2023
158a553
Update contributors-data.js
t-will-gillis Oct 30, 2023
a958b05
Update create-new-issue.js
t-will-gillis Oct 30, 2023
e6e9896
Update create-new-issue.js
t-will-gillis Nov 2, 2023
bdf2661
Create schedule-monthly-PREV.yml
t-will-gillis Nov 13, 2023
35c28c6
Delete .github/workflows/schedule-monthly-PREV.yml
t-will-gillis Nov 13, 2023
b3c65a8
Create schedule-monthly-PREV.yml
t-will-gillis Nov 13, 2023
aac81dc
Update create-new-issue.js
t-will-gillis Nov 22, 2023
1329b56
Update contributors-data.js
t-will-gillis Nov 22, 2023
603e95b
Update contributors-data.js
t-will-gillis Nov 22, 2023
c349364
Update schedule-monthly.yml
t-will-gillis Nov 22, 2023
9e63e0e
Create wr-schedule-monthly.yml
t-will-gillis Nov 23, 2023
1a1329f
Update create-new-issue.js
t-will-gillis Nov 23, 2023
f4f0b03
Create schedule-monthly-reopen.yml
t-will-gillis Nov 23, 2023
2ad2ad2
Update schedule-monthly-PREV.yml
t-will-gillis Nov 23, 2023
fe5ef55
Update schedule-monthly.yml
t-will-gillis Nov 24, 2023
9b8b853
Update contributors-data.js
t-will-gillis Nov 24, 2023
8d005d4
Update wr-schedule-monthly.yml
t-will-gillis Nov 27, 2023
2641e6b
Update schedule-monthly-reopen.yml
t-will-gillis Nov 27, 2023
c3a5f9b
Update issue-trigger.yml
t-will-gillis Nov 29, 2023
f2d3cda
Delete .github/workflows/schedule-monthly-reopen.yml
t-will-gillis Nov 29, 2023
42aac70
Update check-labels.js
t-will-gillis Nov 29, 2023
de7000a
Update create-new-issue.js
t-will-gillis Nov 29, 2023
e9ac3fe
Merge branch 'gh-pages' into fix-sch-monthly-4788
t-will-gillis Nov 29, 2023
afc6a0e
Update create-new-issue.js
t-will-gillis Nov 30, 2023
19006c8
Update contributors-data.js
t-will-gillis Dec 1, 2023
4193a1e
Update create-new-issue.js
t-will-gillis Dec 1, 2023
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
17 changes: 10 additions & 7 deletions .github/workflows/issue-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ on:
types: [opened, transferred, assigned]

jobs:
# Adds newly created issues onto project board in column 'New Issue Approval'
# Adds newly created issues onto project board in the default column 'New Issue Approval'
# unless overridden when issue has "LA website bot" in title, then 'Questions / In Review'
Add-Issue-To-Project-Board:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
env:
COLUMN_NAME: ${{ contains(github.event.issue.title, 'Hack for LA website bot') && 'Questions / In Review' || 'New Issue Approval' }}
steps:
- name: Add issue to project board
uses: alex-page/[email protected]
id: add-issue-project-board
uses: alex-page/[email protected]
with:
project: Project Board
column: New Issue Approval
column: ${{ env.COLUMN_NAME }}
repo-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}

Add-Missing-Labels-To-Issues:
runs-on: ubuntu-latest
# Only trigger this action when an issue is newly created
Expand All @@ -25,8 +28,8 @@ jobs:
- uses: actions/checkout@v4
# Check if the issue has required labels
- name: Check Labels
uses: actions/github-script@v7
id: check-labels
uses: actions/github-script@v7
with:
script: |
const script = require('./github-actions/trigger-issue/add-missing-labels-to-issues/check-labels.js')
Expand Down Expand Up @@ -54,6 +57,7 @@ jobs:
const script = require('./github-actions/trigger-issue/add-missing-labels-to-issues/post-labels-comment.js')
script({g: github, c:context}, results)


#Asking for preliminary update when issue is assigned
Ask-For-Preliminary-update:
runs-on: ubuntu-latest
Expand All @@ -72,7 +76,6 @@ jobs:
const checklabels = script({g: github, c: context})
return checklabels


# Post the comment based on the result of the previous step
- name: Post assigning issue comment
id: assigned-comment
Expand All @@ -81,4 +84,4 @@ jobs:
script: |
const results = ${{ steps.check-labels-prelim.outputs.result }}
const script = require('./github-actions/trigger-issue/add-preliminary-comment/preliminary-update-comment.js')
script({g: github, c:context},results)
script({g: github, c:context},results)
64 changes: 59 additions & 5 deletions .github/workflows/schedule-monthly.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Schedule Monthly

# This action runs at 11:00 UTC/ 3:00 PDT on the first day of the month.
# This action runs at 11:00 UTC/ 3:00 PDT on the first day of every month except January.
on:
schedule:
- cron: 0 11 1 * *
- cron: 0 11 1 2-12 *
workflow_dispatch:

jobs:
trim_contributors:
Trim_Contributors:
runs-on: ubuntu-latest
if: github.repository == 'hackforla/website'

Expand All @@ -15,7 +16,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}

# Setup node
- name: Setup node
Expand All @@ -29,8 +30,61 @@ jobs:
run: npm install
working-directory: ./github-actions/trigger-schedule/github-data

# Run js file- check action logs for inactive members and removes from 'website-write'
# Run js file: checks contributor activity logs, removes two-month inactive members from
# 'website-write' team, then compiles list of one-month inactive members for notification
- name: Trim Members
env:
token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
run: node github-actions/trigger-schedule/github-data/contributors-data.js

# Upload artifact file to allow list sharing with next job "Create_New_Issue"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trim_job_artifact
path: inactive-Members.json


Create_New_Issue:
needs: Trim_Contributors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Download artifact file from "Trim_Contributors"
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v3
with:
name: trim_job_artifact

# Extract and save artifact in usable form for next steps
- name: Extract artifact
id: extract-artifact
run: |
jq -c . inactive-Members.json > out-inactive-Members.json
echo "TRIM_LISTS=$(cat out-inactive-Members.json)" >> $GITHUB_ENV

# Creates a new issue in 'hackforla/website' repo with the saved lists
- name: Create new issue
uses: actions/github-script@v7
id: create-new-issue
with:
github-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
script: |
const artifactContent = process.env.TRIM_LISTS;
const script = require('./github-actions/trigger-schedule/list-inactive-members/create-new-issue.js');
const createNewIssue = script({g: github, c: context}, artifactContent);
return createNewIssue;

# Comments on issue #2607, notifying leads that the above issue has been created
- name: Comment issue
uses: actions/github-script@v7
id: comment-issue
with:
github-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
script: |
const script = require('./github-actions/trigger-schedule/list-inactive-members/comment-issue.js');
const newIssueNumber = ${{ steps.create-new-issue.outputs.result }};
script({g: github, c: context}, newIssueNumber);

46 changes: 46 additions & 0 deletions .github/workflows/wr-schedule-monthly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: WR Schedule Monthly

on:
workflow_run:
workflows: ['Schedule Monthly']
types: [completed]

jobs:
On-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo "The 'Schedule Monthly' workflow succeeded. Continuing."

# If 'Schedule Monthly' was succcesful, retrieve the owner URL
- name: Get owner url
id: get-owner-url
uses: actions/github-script@v7
with:
script: |
const ownerURL = context.payload.repository.html_url;
console.log("Owner url: " + ownerURL);
return ownerURL;

# Then retrieve the latest issue created in the repo (i.e. by 'Schedule Monthly')
- name: Get issue number
id: get-issue-number
uses: actions/github-script@v7
with:
script: |
const newIssue = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state:"all",
per_page: 1,
page: 1,
});
const newIssueNumber = newIssue['data'][0]['number'];
console.log("Latest issue number: " + newIssueNumber);
return newIssueNumber;

# Automatically close this last issue- that is, the issue just created by 'Schedule Monthly'
- name: Auto close issue
run: gh issue close "${{ steps.get-owner-url.outputs.result }}/issues/${{ steps.get-issue-number.outputs.result }}"
env:
GH_TOKEN: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const REQUIRED_LABELS = ['Complexity', 'role', 'Feature']
const LABEL_MISSING = ['Complexity: Missing', 'role missing', 'Feature Missing']
const COMPLEXITY_EXCEPTIONS = ['good first issue']

// SPECIAL_CASE is for issue created by reference with issue title "Hack for LA website bot" (from "Review Inactive Team Members")
const SPECIAL_CASE = ['ready for dev lead','Feature: Administrative','size: 0.25pt','Complexity: Small','role: dev leads']

// Global variables
var github
var context
Expand All @@ -17,10 +20,16 @@ async function main({ g, c }) {
github = g
context = c
const issueNum = context.payload.issue.number
const issueTitle = context.payload.issue.title

const labels = obtainLabels()
const filteredLabels = filterLabels(labels)
const labelsToAdd = checkLabels(filteredLabels)
let labelsToAdd = checkLabels(filteredLabels)

// for SPECIAL_CASE noted above
if (issueTitle.includes('Hack for LA website bot')) {
labelsToAdd = SPECIAL_CASE;
}
console.log('Labels to add: ', labelsToAdd)

const result = await addLabels(labelsToAdd, filteredLabels)
Expand Down
Loading