Skip to content

Commit

Permalink
fix: update projen
Browse files Browse the repository at this point in the history
  • Loading branch information
Court Schuett committed Aug 29, 2024
1 parent e4f79a1 commit 2dbd3bf
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .github/workflows/upgrade-submodules-undefined.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .projen/files.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 3 additions & 26 deletions .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const metapromptGenerator = require('./subprojects/metaprompt-generator');
const claudeToolsChatbot = require('./subprojects/claude-tools-chat-bot');
const complexSchemaToolUseNextJS = require('./subprojects/complex-schema-tool-use-nextjs');
const classificationWithIntercom = require('./subprojects/classification-with-intercom');
const upgradeSubmodules = require('./workflows.ts');

const root = new NodeProject({
name: 'anthropic-on-aws',
Expand Down Expand Up @@ -45,6 +46,8 @@ claudeToolsChatbot(root);
complexSchemaToolUseNextJS(root);
classificationWithIntercom(root);

root.addUpgradeSubmodulesWorkflow();

const common_exclude = [
'.yalc',
'cdk.out',
Expand All @@ -69,31 +72,5 @@ const common_exclude = [
'!docs/images/',
];

// Add this new section to create the submodule update workflow
root.github
.addWorkflow('update-submodules')
.on({
schedule: [{ cron: '0 0 * * 0' }], // Run every Sunday at midnight
workflow_dispatch: {}, // Allow manual triggering
})
.addJobs({
update: {
runsOn: ['ubuntu-latest'],
steps: [
{
uses: 'actions/checkout@v3',
with: { 'fetch-depth': 0, 'submodules': 'recursive' },
},
{ run: 'git config user.name github-actions' },
{ run: 'git config user.email github-actions@github.com' },
{ run: 'git submodule update --remote --merge' },
{
run: 'git commit -am "Update submodules" || echo "No changes to commit"',
},
{ run: 'git push' },
],
},
});

root.gitignore.exclude(...common_exclude);
root.synth();
49 changes: 49 additions & 0 deletions workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,52 @@ NodeProject.prototype.addBuildWorkflow = function (projectName, directory) {
},
});
};

NodeProject.prototype.addUpgradeSubmodulesWorkflow = function (projectName) {
const upgradeSubmodules = this.github.addWorkflow(
'upgrade-submodules-' + projectName,
);
upgradeSubmodules.on({
schedule: [{ cron: '0 0 * * 0' }], // Run every Sunday at midnight
workflowDispatch: {},
});

upgradeSubmodules.addJobs({
[`upgrade-submodules-${projectName}`]: {
runsOn: ['ubuntu-latest'],
name: `upgrade-submodules-${projectName}`,
permissions: {
contents: JobPermission.WRITE,
},
steps: [
{
uses: 'actions/checkout@v3',
with: {
'fetch-depth': 0,
'submodules': 'recursive',
'token': '${{ secrets.' + AUTOMATION_TOKEN + ' }}',
},
},
{
name: 'Update submodules',
run: 'git submodule update --remote --merge',
},
{
name: 'Create Pull Request',
uses: 'peter-evans/create-pull-request@v4',
with: {
'token': '${{ secrets.' + AUTOMATION_TOKEN + ' }}',
'commit-message': `chore: update submodules for ${projectName}`,
'branch': `auto/submodules-update-${projectName}`,
'title': `chore: update submodules for ${projectName}`,
'body': `This PR updates submodules for ${projectName}`,
'labels': 'auto-merge, auto-approve',
'author': 'github-actions <github-actions@github.com>',
'committer': 'github-actions <github-actions@github.com>',
'signoff': true,
},
},
],
},
});
};

0 comments on commit 2dbd3bf

Please sign in to comment.