forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb2ed7a
commit 47cf9ce
Showing
2 changed files
with
152 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,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) | ||
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); |