Skip to content

Schedule Monthly

Schedule Monthly #5

name: Schedule Monthly
# 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 2-12 *
workflow_dispatch:
jobs:
Trim_Contributors:
runs-on: ubuntu-latest
if: github.repository == 'hackforla/website'
steps:
# Checkout repo
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }}
# Setup node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
# Install dependencies to run js file
- name: Install npm dependencies
run: npm install
working-directory: ./github-actions/trigger-schedule/github-data
# 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@v4
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@v4
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')
script({g: github, c: context}, artifactContent)