generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1349 from hackforla/1176-roster-action
1176 Monthly roster action
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Monthly roster update | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 1 * *" # Runs on the 1st of every month at 00:00 UTC | ||
|
||
jobs: | ||
duplicate-issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Duplicate Issue | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const issueNumber = 1065; | ||
const issue = await github.rest.issues.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issueNumber | ||
}); | ||
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; | ||
const currentMonth = months[new Date().getMonth()]; | ||
const newIssue = await github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: `${currentMonth} ${issue.data.title}`, | ||
body: issue.data.body, | ||
labels: issue.data.labels.map(label => label.name), | ||
milestone: issue.data.milestone ? issue.data.milestone.number : undefined | ||
}); |