forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Auto assign datascience issues #14147
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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,123 @@ | ||
name: Assign DS issue to someone | ||
on: | ||
issues: | ||
types: [opened] | ||
jobs: | ||
assignIssue: | ||
name: Assign Issue to Someone | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'microsoft/vscode-python' | ||
steps: | ||
- name: Created internally | ||
id: internal | ||
env: | ||
ISSUE_OWNER: ${{github.event.issue.owner.login}} | ||
run: | | ||
echo ::set-output name=result::$(node -p -e "['rchiodo', 'greazer', 'joyceerhl', 'DavidKutu', 'claudiaregio', 'IanMatthewHuff', 'DonJayamanne'].filter(item => process.env.ISSUE_OWNER.toLowerCase() === item.toLowerCase()).length > 0 ? 1 : 0") | ||
shell: bash | ||
- name: Should we proceed | ||
id: proceed | ||
env: | ||
ISSUE_LABELS: ${{toJson(github.event.issue.labels)}} | ||
ISSUE_ASSIGNEES: ${{toJson(github.event.issue.assignees)}} | ||
ISSUE_IS_INTERNAL: ${{steps.internal.outputs.result}} | ||
run: | | ||
echo ::set-output name=result::$(node -p -e "process.env.ISSUE_IS_INTERNAL === '0' && JSON.parse(process.env.ISSUE_ASSIGNEES).length === 0 && JSON.parse(process.env.ISSUE_LABELS).filter(item => item.name.indexOf('data science') >= 0).length === 0 ? 1 : 0") | ||
shell: bash | ||
- uses: actions/checkout@v2 | ||
if: steps.proceed.outputs.result == 1 | ||
- name: Day of week | ||
if: steps.proceed.outputs.result == 1 | ||
id: day | ||
run: | | ||
echo ::set-output name=number::$(node -p -e "new Date().getDay()") | ||
shell: bash | ||
- name: Hour of day | ||
if: steps.proceed.outputs.result == 1 | ||
id: hour | ||
run: | | ||
echo ::set-output name=hour::$(node -p -e "(new Date().getUTCHours() - 7)%24") | ||
shell: bash | ||
- name: Week Number | ||
if: steps.proceed.outputs.result == 1 | ||
id: week | ||
run: | | ||
echo ::set-output name=odd::$(node .github/workflows/week.js) | ||
shell: bash | ||
- name: Print day and week | ||
if: steps.proceed.outputs.result == 1 | ||
run: | | ||
echo ${{steps.day.outputs.number}} | ||
echo ${{steps.week.outputs.odd}} | ||
echo ${{steps.hour.outputs.hour}} | ||
shell: bash | ||
- name: Even late friday (David) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could put all of this in to a JS file, again, felt this was easier to main than having to write a JS file & then push data into JS via Env variables & then pull via console output. |
||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 0 && steps.day.outputs.number == 5 && steps.hour.outputs.hour >= 16 | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign DavidKutu | ||
- name: Odd late friday (Joyce) | ||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 1 && steps.day.outputs.number == 5 && steps.hour.outputs.hour >= 16 | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign joyceerhl | ||
- name: Odd weekends (David) | ||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 1 && (steps.day.outputs.number == 6 || steps.day.outputs.number == 0) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign DavidKutu | ||
- name: Even weekends (Joyce) | ||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 0 && (steps.day.outputs.number == 6 || steps.day.outputs.number == 0) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign joyceerhl | ||
- name: Odd Monday (David) | ||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 1 && steps.day.outputs.number == 1 && steps.hour.outputs.hour < 16 | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign DavidKutu | ||
- name: Even Monday (Joyce) | ||
if: steps.proceed.outputs.result == 1 && steps.week.outputs.odd == 0 && steps.day.outputs.number == 1 && steps.hour.outputs.hour < 16 | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign joyceerhl | ||
- name: Tuesday (Ian) | ||
if: steps.proceed.outputs.result == 1 && (steps.day.outputs.number == 1 && steps.hour.outputs.hour >= 16) || (steps.day.outputs.number == 2 && steps.hour.outputs.hour < 16) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign IanMatthewHuff | ||
- name: Wednesday (Rich) | ||
if: steps.proceed.outputs.result == 1 && (steps.day.outputs.number == 2 && steps.hour.outputs.hour >= 16) || (steps.day.outputs.number == 3 && steps.hour.outputs.hour < 16) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign rchiodo | ||
- name: Thursday (Don) | ||
if: steps.proceed.outputs.result == 1 && (steps.day.outputs.number == 3 && steps.hour.outputs.hour >= 16) || (steps.day.outputs.number == 4 && steps.hour.outputs.hour < 16) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign DonJayamanne | ||
- name: Friday (Claudia) | ||
if: steps.proceed.outputs.result == 1 && (steps.day.outputs.number == 4 && steps.hour.outputs.hour >= 16) || (steps.day.outputs.number == 5 && steps.hour.outputs.hour < 16) | ||
uses: actions/github@v1.0.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: assign claudiaregio |
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,29 @@ | ||
/* For a given date, get the ISO week number | ||
* | ||
* Based on information at: | ||
* | ||
* http://www.merlyn.demon.co.uk/weekcalc.htm#WNR | ||
* | ||
* Algorithm is to find nearest thursday, it's year | ||
* is the year of the week number. Then get weeks | ||
* between that date and the first day of that year. | ||
* | ||
* Note that dates in one year can be weeks of previous | ||
* or next year, overlap is up to 3 days. | ||
* | ||
* e.g. 2014/12/29 is Monday in week 1 of 2015 | ||
* 2012/1/1 is Sunday in week 52 of 2011 | ||
*/ | ||
function getWeekNumber(d) { | ||
// Copy date so don't modify original | ||
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())); | ||
// Set to nearest Thursday: current date + 4 - current day number | ||
// Make Sunday's day number 7 | ||
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7)); | ||
// Get first day of year | ||
var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)); | ||
// Calculate full weeks to nearest Thursday | ||
return Math.ceil(((d - yearStart) / 86400000 + 1) / 7); | ||
} | ||
// Whether it is an odd or event week. | ||
console.log(getWeekNumber(new Date()) % 2); |
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.
Chose to write all of the code in github action rather than creating a seprate .js file with the logic in there. This way its more clear & easier to maintain.