Skip to content

Commit

Permalink
Bug fix 6803 (hackforla#6804)
Browse files Browse the repository at this point in the history
* Update get-contributors-data.js

* Update create-new-issue.js

* Update schedule-monthly.yml

* Update wr-schedule-monthly.yml

* Update create-new-issue.js

* Update get-contributors-data.js

* Update get-contributors-data.js
  • Loading branch information
t-will-gillis authored May 3, 2024
1 parent 047e7ef commit 5cbab43
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/schedule-monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
# Commits list of inactive members to repo for using in next step, and in one month
- name: Update Inactive Members JSON
id: update-inactive-members-json
uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
# Glob pattern of file which should be added to the commit
Expand All @@ -48,20 +49,3 @@ jobs:
# Optional commit message and author settings
commit_message: Update Inactive Members JSON
commit_author: GitHub Actions Bot <hackforla-bot@hackforla.org>


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

# Creates a new issue in 'hackforla/website' repo with the saved lists
- name: Create new issue
id: create-new-issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
script: |
const script = require('./github-actions/trigger-schedule/list-inactive-members/create-new-issue.js')
script({g: github, c: context})
20 changes: 18 additions & 2 deletions .github/workflows/wr-schedule-monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@ on:
types: [completed]

jobs:
On-success:
Create-New-Issue:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo "The 'Schedule Monthly' workflow succeeded. Continuing."
- uses: actions/checkout@v4

# If 'Schedule Monthly' was succcesful, retrieve the owner URL
# Creates a new issue in 'hackforla/website' repo with the saved lists
- name: Create new issue
id: create-new-issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
script: |
const script = require('./github-actions/trigger-schedule/list-inactive-members/create-new-issue.js')
script({g: github, c: context})
Close-New-Issue:
needs: Create-New-Issue
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get owner url
id: get-owner-url
uses: actions/github-script@v7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const createIssue = async (owner, repo, inactiveLists) => {
labels,
milestone,
});
console.log('Created issue ' + thisIssueNumber);
return issue.data;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const getTeamMembers = require('../../utils/get-team-members');
var github;
var context;

const maintTeam = 'website-maintain';
const botMembers = ['elizabethhonest', 'hfla-website-checklist', 'HackforLABot'];

// Set date limits: we are sorting inactive members into groups to warn after 1 month and remove after 2 months.
// Since the website team takes off the month of December, the January 1st run is skipped (via `schedule-monthly.yml`).
// The February 1st run keeps the 1 month inactive warning, but changes removal to 3 months inactive (skipping December).
Expand Down Expand Up @@ -59,7 +62,6 @@ async function fetchContributors(dates){
let inactiveWithOpenIssue = {};

// Members of 'website-maintain' team are considered permanent members
const maintTeam = 'website-maintain';
const permanentMembers = await getTeamMembers(github, context, maintTeam);

// Fetch all contributors with commit, comment, and issue (assignee) contributions
Expand All @@ -79,8 +81,8 @@ async function fetchContributors(dates){
while(true){
// Fetch 100 items per each page (`pageNum`)
const contributors = await github.request(api, {
owner: github.context.owner,
repo: github.context.repo,
owner: context.repo.owner,
repo: context.repo.repo,
since: date,
per_page: 100,
page: pageNum
Expand Down Expand Up @@ -133,9 +135,14 @@ async function fetchContributors(dates){
}
}
// Add permanent members from 'website-maintain' team to list of active contributors
for(const permanentMember in permanentMembers){
for(let permanentMember in permanentMembers){
allContributorsSince[permanentMember] = true;
}
// Add members of botMembers team to list of active contributors
for(let i = 0; i < botMembers.length; i++){
allContributorsSince[botMembers[i]] = true;
}

if(date === dates[0]){
allContributorsSinceOneMonthAgo = allContributorsSince;
} else {
Expand Down

0 comments on commit 5cbab43

Please sign in to comment.