forked from hackforla/website
-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (76 loc) · 2.87 KB
/
schedule-monthly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Schedule Monthly
# This action runs at 11:00 UTC/ 3:00 PDT on the first day of the month.
on:
schedule:
- cron: 0 11 1 * *
workflow_dispatch:
jobs:
Trim_Contributors:
runs-on: ubuntu-latest
if: github.repository == 't-will-gillis/website'
steps:
# Checkout repo
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.TEST_GHAS }}
# 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.TEST_GHAS }}
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@v6
id: create-new-issue
with:
github-token: ${{ secrets.thwart }}
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@v6
id: comment-issue
with:
github-token: ${{ secrets.thwart }}
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);