-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add GH workflow to automate projects (#1756)
* Create project_automation.yml * Create priority_bumper.yml
- Loading branch information
Showing
2 changed files
with
84 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,34 @@ | ||
name: Projects priority automation | ||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
bump_to_p2: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.issue.comments > 10 }} | ||
steps: | ||
- name: Bump to P2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PROJECT_WORKFLOW_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
ISSUE_ID: ${{ github.event.issue.node_id }} | ||
FIELD_ID: ${{ secrets.PRIORITY_COL }} | ||
FIELD_OPT_ID: ${{ secrets.P2_OPT_ID }} | ||
shell: bash | ||
run: curl -s POST https://api.github.com/graphql -H "Authorization:Bearer $GITHUB_TOKEN" --data '{"query":"mutation {updateProjectNextItemField(input:{projectId:\"${{ env.PROJECT_ID }}\" itemId:\"${{ env.ISSUE_ID }}\" fieldId:\"${{ env.FIELD_ID }}\" value:\"${{ env.FIELD_OPT_ID }}\"}) {projectNextItem {id}}}"}' > /dev/null | ||
|
||
bump_to_p1: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.issue.comments > 15 }} | ||
steps: | ||
- name: Bump to P1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PROJECT_WORKFLOW_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
ISSUE_ID: ${{ github.event.issue.node_id }} | ||
FIELD_ID: ${{ secrets.PRIORITY_COL }} | ||
FIELD_OPT_ID: ${{ secrets.P1_OPT_ID }} | ||
shell: bash | ||
run: curl -s POST https://api.github.com/graphql -H "Authorization:Bearer $GITHUB_TOKEN" --data '{"query":"mutation {updateProjectNextItemField(input:{projectId:\"${{ env.PROJECT_ID }}\" itemId:\"${{ env.ISSUE_ID }}\" fieldId:\"${{ env.FIELD_ID }}\" value:\"${{ env.FIELD_OPT_ID }}\"}) {projectNextItem {id}}}"}' > /dev/null | ||
|
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,50 @@ | ||
name: Projects beta automation | ||
on: | ||
issues: | ||
types: [opened, assigned, unassigned, labeled, unlabeled] | ||
|
||
jobs: | ||
add_issue: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.action == 'opened' }} | ||
steps: | ||
- name: Add to project | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PROJECT_WORKFLOW_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
ISSUE_ID: ${{ github.event.issue.node_id }} | ||
shell: bash | ||
run: | | ||
curl -s POST https://api.github.com/graphql -H "Authorization:Bearer $GITHUB_TOKEN" --data '{"query":"mutation {addProjectNextItem(input:{projectId:\"${{ env.PROJECT_ID }}\" contentId:\"${{ env.ISSUE_ID }}\"}) {projectNextItem {id}}}"}' > /dev/null | ||
move_to_wip: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.action == 'assigned' || contains(github.event.issue.labels.*.name, 'pending-response') || contains(github.event.issue.labels.*.name, 'closing soon') }} | ||
steps: | ||
- name: Move to WIP column | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PROJECT_WORKFLOW_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
ISSUE_ID: ${{ github.event.issue.node_id }} | ||
FIELD_ID: ${{ secrets.STATUS_COL }} | ||
FIELD_OPT_ID: ${{ secrets.WIP_OPT_ID }} | ||
shell: bash | ||
run: | | ||
curl -s POST https://api.github.com/graphql -H "Authorization:Bearer $GITHUB_TOKEN" —data '{"query":"mutation {updateProjectNextItemField(input:{projectId:\"${{ env.PROJECT_ID }}\" itemId:\"${{ env.ISSUE_ID }}\" fieldId:\"${{ env.FIELD_ID }}\" value:\"${{ env.FIELD_OPT_ID }}\"}) {projectNextItem {id}}}"}' > /dev/null | ||
move_to_todo: | ||
runs-on: ubuntu-latest | ||
if: ${{ join(github.event.issue.assignees.*.login) == '' && !contains(github.event.issue.labels.*.name, 'pending-response') && !contains(github.event.issue.labels.*.name, 'closing soon') }} | ||
steps: | ||
- name: Move to Todo column | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PROJECT_WORKFLOW_TOKEN }} | ||
PROJECT_ID: ${{ secrets.PROJECT_ID }} | ||
ISSUE_ID: ${{ github.event.issue.node_id }} | ||
FIELD_ID: ${{ secrets.STATUS_COL }} | ||
FIELD_OPT_ID: ${{ secrets.TODO_OPT_ID }} | ||
shell: bash | ||
run: | | ||
curl -s POST https://api.github.com/graphql -H "Authorization:Bearer $GITHUB_TOKEN" --data '{"query":"mutation {updateProjectNextItemField(input:{projectId:\"${{ env.PROJECT_ID }}\" itemId:\"${{ env.ISSUE_ID }}\" fieldId:\"${{ env.FIELD_ID }}\" value:\"${{ env.FIELD_OPT_ID }}\"}) {projectNextItem {id}}}"}' > /dev/null | ||