generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1176 Monthly roster action #1349
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d673b52
added yml file in workflows folder for new action need to test
hasham-qaiser 767f6c0
updated yml file
hasham-qaiser cd0f0f8
updated yml file to include labels
hasham-qaiser 3026b07
projects label
hasham-qaiser 6f1338a
updated yml file to include month in title
hasham-qaiser 0affd5d
removed lines regarding project
hasham-qaiser File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,53 @@ | ||
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 | ||
}); | ||
|
||
// Add the new issue to the same project as the original issue | ||
if (issue.data.project_url) { | ||
const projectId = issue.data.project_url.split('/').pop(); | ||
const project = await github.rest.projects.get({ | ||
project_id: projectId | ||
}); | ||
const projectNumber = project.data.number; | ||
|
||
await github.rest.issues.addToProject({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: newIssue.data.number, | ||
project_id: projectNumber | ||
}); | ||
} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the project lines aren't working right now, lets remove them.