-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
feat: add opt-in Block for automatic CTA transitions for Renovate #2000
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3c07b72
feat: add opt-in Block for automatic CTA transitions for Renovate
JoshuaKGoldberg 95b8733
Fill out action contents
JoshuaKGoldberg 06c5b4d
docs: npx all-contributors-cli add natepmay bug
JoshuaKGoldberg 87f8bae
Added missing 'if' and corrected 'with'
JoshuaKGoldberg ace58f1
Merge branch 'main' into cta-transitions-renovate
JoshuaKGoldberg 30e928b
rm package-lock.json
JoshuaKGoldberg 302643a
Ha, actually write the test
JoshuaKGoldberg bd47c00
Merge branch 'main' into cta-transitions-renovate
JoshuaKGoldberg de51a04
Knip
JoshuaKGoldberg b6b83dc
stefanzweifel
JoshuaKGoldberg 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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,75 @@ | ||
import { testBlock } from "bingo-stratum-testers"; | ||
import { describe, expect, test } from "vitest"; | ||
|
||
import { blockCTATransitions } from "./blockCTATransitions.js"; | ||
import { optionsBase } from "./options.fakes.js"; | ||
|
||
describe("blockCTATransitions", () => { | ||
test("production", () => { | ||
const creation = testBlock(blockCTATransitions, { | ||
options: optionsBase, | ||
}); | ||
|
||
expect(creation).toMatchInlineSnapshot(` | ||
{ | ||
"addons": [ | ||
{ | ||
"addons": { | ||
"jobs": [ | ||
{ | ||
"checkoutWith": { | ||
"fetch-depth": "0", | ||
"ref": "\${{github.event.pull_request.head.ref}}", | ||
"repository": "\${{github.event.pull_request.head.repo.full_name}}", | ||
"token": ""\${{ secrets.ACCESS_TOKEN }}"", | ||
}, | ||
"if": "\${{ startsWith(github.head_ref, 'renovate/') && contains(github.event.pull_request.title, 'create-typescript-app') }}", | ||
"name": "CTA Transitions", | ||
"steps": [ | ||
{ | ||
"run": "pnpx create-typescript-app", | ||
}, | ||
{ | ||
"uses": "stefanzweifel/git-auto-commit-action@v5", | ||
"with": { | ||
"commit_author": "The Friendly Bingo Bot <[email protected]>", | ||
"commit_message": "Check in changes from re-running npx create-typescript-app", | ||
"commit_user_email": "[email protected]", | ||
"commit_user_name": "The Friendly Bingo Bot", | ||
}, | ||
}, | ||
{ | ||
"uses": "mshick/add-pr-comment@v2", | ||
"with": { | ||
"issue": "\${{ github.event.pull_request.number }}", | ||
"message": "| | ||
🤖 Beep boop! I ran \`npx create-typescript-app\` and found same changes. | ||
Please review the latest commit to see if you want to merge it. | ||
Cheers! 💝 | ||
|
||
> This change was automatically made in CI to keep your repository up-to-date with the templating in [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app). | ||
> If you want to opt out of these automatic updates, delete the \`.github/workflows/cta-transitions.yml\` file on your \`main\` branch.", | ||
"repo-token": "\${{ secrets.ACCESS_TOKEN }}", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
"block": [Function], | ||
}, | ||
{ | ||
"addons": { | ||
"properties": { | ||
"devDependencies": { | ||
"create-typescript-app": "2.7.3", | ||
}, | ||
}, | ||
}, | ||
"block": [Function], | ||
}, | ||
], | ||
} | ||
`); | ||
}); | ||
}); |
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,67 @@ | ||
import { base } from "../base.js"; | ||
import { packageData } from "../data/packageData.js"; | ||
import { blockGitHubActionsCI } from "./blockGitHubActionsCI.js"; | ||
import { blockPackageJson } from "./blockPackageJson.js"; | ||
|
||
export const blockCTATransitions = base.createBlock({ | ||
about: { | ||
name: "CTA Transitions", | ||
}, | ||
produce() { | ||
return { | ||
addons: [ | ||
blockGitHubActionsCI({ | ||
jobs: [ | ||
{ | ||
checkoutWith: { | ||
"fetch-depth": "0", | ||
ref: "${{github.event.pull_request.head.ref}}", | ||
repository: | ||
"${{github.event.pull_request.head.repo.full_name}}", | ||
token: '"${{ secrets.ACCESS_TOKEN }}"', | ||
}, | ||
if: "${{ startsWith(github.head_ref, 'renovate/') && contains(github.event.pull_request.title, 'create-typescript-app') }}", | ||
name: "CTA Transitions", | ||
steps: [ | ||
{ run: "pnpx create-typescript-app" }, | ||
{ | ||
uses: "stefanzweifel/git-auto-commit-action@v5", | ||
with: { | ||
commit_author: "The Friendly Bingo Bot <[email protected]>", | ||
commit_message: | ||
"Check in changes from re-running npx create-typescript-app", | ||
commit_user_email: "[email protected]", | ||
commit_user_name: "The Friendly Bingo Bot", | ||
}, | ||
}, | ||
{ | ||
uses: "mshick/add-pr-comment@v2", | ||
with: { | ||
issue: "${{ github.event.pull_request.number }}", | ||
message: [ | ||
"|", | ||
"🤖 Beep boop! I ran `npx create-typescript-app` and found same changes.", | ||
"Please review the latest commit to see if you want to merge it.", | ||
"Cheers! 💝", | ||
"", | ||
"> This change was automatically made in CI to keep your repository up-to-date with the templating in [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).", | ||
"> If you want to opt out of these automatic updates, delete the `.github/workflows/cta-transitions.yml` file on your `main` branch.", | ||
].join("\n"), | ||
"repo-token": "${{ secrets.ACCESS_TOKEN }}", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}), | ||
blockPackageJson({ | ||
properties: { | ||
devDependencies: { | ||
"create-typescript-app": packageData.version, | ||
}, | ||
}, | ||
}), | ||
], | ||
}; | ||
}, | ||
}); |
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
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
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
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
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.
#1992