-
Notifications
You must be signed in to change notification settings - Fork 77
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
ci: add design complete automation #7184
Merged
geospatialem
merged 4 commits into
master
from
geospatialem/ci-design-complete-automation
Jun 16, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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,76 @@ | ||
# When the "design-complete" label is added to an issue: | ||
# 1. Modifies the labels, | ||
# 2. Updates the assignees and milestone, and | ||
# 3. Generates a notification to the Calcite project manager(s) | ||
# | ||
# The secret is formatted like so: person1, person2, person3 | ||
# | ||
# Note the script automatically adds the "@" character in to notify the project manager(s) | ||
name: "Design complete" | ||
|
||
on: | ||
issues: | ||
types: [labeled] | ||
|
||
jobs: | ||
design-complete: | ||
if: github.event.label.name == 'design-complete' | ||
permissions: | ||
issues: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v6 | ||
env: | ||
managers: ${{secrets.CALCITE_MANAGERS}} | ||
with: | ||
script: | | ||
const { managers } = process.env; | ||
const { label } = context.payload; | ||
|
||
if (label && label.name === "design-complete") { | ||
|
||
// Add a "@" character to notify the user | ||
const calcite_managers = managers.split(",").map(v => " @" + v.trim()); | ||
|
||
const issueProps = { | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
} | ||
|
||
/* Modify labels */ | ||
|
||
// Remove "Design" label | ||
await github.rest.issues.removeLabel({ | ||
...issueProps, | ||
name: "design" | ||
}); | ||
|
||
// Remove "1 - assigned" label | ||
await github.rest.issues.removeLabel({ | ||
...issueProps, | ||
name: "1 - assigned" | ||
}); | ||
|
||
// Add labels | ||
await github.rest.issues.addLabels({ | ||
...issueProps, | ||
labels: ['0 - new', 'needs milestone'] | ||
}) | ||
|
||
/* Update issue */ | ||
|
||
// Clear assignees and milestone | ||
await github.rest.issues.update({ | ||
...issueProps, | ||
assignees: [], | ||
milestone: null | ||
}); | ||
|
||
// Add a comment to notify the project manager(s) | ||
await github.rest.issues.createComment({ | ||
...issueProps, | ||
body: `cc ${calcite_managers}`, | ||
}); | ||
|
||
} |
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.
The API calls are pretty expressive, so one suggestion to remove some comments with duplicate info is to use an object for common props and spread into each call: