Skip to content

WR Schedule Monthly

WR Schedule Monthly #1

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 }}