Repository navigation
ci: release automatically from conventional commits #63
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4401ec0
ci: release automatically from conventional commits
malini-agent[bot] c950dd0
Move @logdash/node from changesets to automatic releases from Convent…
malini-agent[bot] 0c535a7
Move @logdash/node from changesets to automatic releases from Convent…
malini-agent[bot] e8fadf9
Move @logdash/node from changesets to automatic releases from Convent…
malini-agent[bot] 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,45 @@ | ||
| name: Approval | ||
|
|
||
| # Logdash team members merge their own pull requests on green checks. | ||
| # Pull requests from anyone else need a team member to approve their latest commit; outside collaborators cannot approve each other's. | ||
| # GitHub judges a required check by its newest run, so every run reads the reviews as they stand and never skips. | ||
| # ponytail: anyone with write access can edit this file on their branch, so it stops accidental merges, not deliberate ones. | ||
| on: | ||
| pull_request: | ||
| pull_request_review: | ||
| types: [submitted, dismissed] | ||
|
|
||
| permissions: | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| approval: | ||
| name: team approval | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| AUTHOR: ${{ github.event.pull_request.author_association }} | ||
| PR: ${{ github.event.pull_request.number }} | ||
| HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| case "$AUTHOR" in OWNER|MEMBER) echo "Opened by a Logdash team member."; exit 0 ;; esac | ||
| # Private organization members can show up as CONTRIBUTOR or NONE here, so a team review is a user review with write access from anyone but an outside collaborator. | ||
| # shellcheck disable=SC2016 # $owner, $name and $pr are GraphQL variables, not shell ones. | ||
| verdict=$(gh api graphql -F pr="$PR" -f owner="${GITHUB_REPOSITORY%/*}" -f name="${GITHUB_REPOSITORY#*/}" -f query=' | ||
| query($owner: String!, $name: String!, $pr: Int!) { | ||
| repository(owner: $owner, name: $name) { | ||
| pullRequest(number: $pr) { | ||
| latestOpinionatedReviews(first: 100, writersOnly: true) { | ||
| nodes { state authorAssociation author { __typename } commit { oid } } | ||
| } | ||
| } | ||
| } | ||
| }' | jq -r --arg head "$HEAD" ' | ||
| [.data.repository.pullRequest.latestOpinionatedReviews.nodes[] | select(.author.__typename == "User" and .authorAssociation != "COLLABORATOR")] | ||
| | if any(.state == "CHANGES_REQUESTED") then "A Logdash team member requested changes" | ||
| elif any(.state == "APPROVED" and .commit.oid == $head) then "approved" | ||
| else "No Logdash team member has approved the latest commit yet" end') | ||
| [ "$verdict" = approved ] && { echo "Approved by a Logdash team member."; exit 0; } | ||
| echo "::error::$verdict. Outside contributions merge once a Logdash team member approves their latest commit." | ||
| exit 1 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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,20 @@ | ||
| name: PR title | ||
|
|
||
| # Squash merges use the PR title as the commit subject, and scripts/version.ts reads it to pick the next version. | ||
| on: | ||
| pull_request: | ||
| types: [opened, edited, reopened, synchronize] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| conventional: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - env: | ||
| TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| printf '%s' "$TITLE" | grep -qE '^(feat|fix|perf|refactor|docs|test|build|ci|chore|style|revert)(\(.+\))?!?: .+' || { | ||
| echo "::error::PR title \"$TITLE\" is not a Conventional Commit, e.g. \"feat: add track for events\" or \"fix(queue): retry only failed metrics\". feat releases a minor, fix/perf a patch, ! a major; other types do not release." | ||
| exit 1 | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.