forked from hackforla/website
-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (55 loc) · 2.08 KB
/
wr-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
name: WR Schedule Monthly
on:
workflow_run:
workflows: ['Schedule Monthly']
types: [completed]
jobs:
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
# 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
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 }}