Skip to content

Commit

Permalink
Merge branch 'main' into add-nft-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
sateeshperi authored Oct 8, 2024
2 parents d440b82 + 5f4e2ce commit f71af1e
Show file tree
Hide file tree
Showing 83 changed files with 8,099 additions and 3,133 deletions.
Binary file modified .cache.tar.xz
Binary file not shown.
30 changes: 23 additions & 7 deletions .github/workflows/add-netlify-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,62 @@ jobs:
with:
github-token: ${{ secrets.NF_CORE_BOT_AUTH_TOKEN }}
script: |
const changedFiles = `${{ steps.changed-files.outputs.all_changed_files }}`.split(' ').slice(0, 50);
let changedFiles = `${{ steps.changed-files.outputs.all_changed_files }}`.split(' ').slice(0, 50);
console.log('Changed files:', changedFiles)
// remove the sites/** prefix until src
const processedFiles = changedFiles.map(file => file.replace(/^sites\/[^/]+\//, ''));
console.log('Processed files:', processedFiles);
// handle normal pages
let netlifyLinks = changedFiles
let netlifyLinks = processedFiles
.filter(file => file.startsWith('src/pages/'))
.filter(file => !file.endsWith('].astro')) // skip dynamic routes
.map(file => `@netlify ${file?.replace('src/pages/', '/')}`)[0]
?.replace(/\.md$/, '').replace(/\.mdx$/, '').replace(/\.astro$/, '').replace(/\/index$/, '');
?.replace(/\.md$/, '')
.replace(/\.mdx$/, '')
.replace(/\.astro$/, '')
.replace(/\/index$/, '');
// handle pages in content collections
if (!netlifyLinks) {
netlifyLinks = changedFiles
netlifyLinks = processedFiles
.filter(file => file.startsWith('src/content/'))
.map(file => `@netlify ${file?.replace('src/content/', '/')}`)[0]
?.replace(/\.md$/, '').replace(/\.mdx$/, '').replace(/\/index$/, '');
?.replace(/\.md$/, '')
.replace(/\.mdx$/, '')
.replace(/\/index$/, '');
}
console.log('Netlify links:', netlifyLinks)
console.log('Netlify links:', netlifyLinks);
if (netlifyLinks) {
console.log('Adding Netlify link to PR body' ,context.payload.pull_request.number);
console.log('Adding Netlify link to PR body', context.payload.pull_request.number);
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
console.log('Current PR:', pullRequest);
console.log('Current PR body:', pullRequest.body);
const currentBody = pullRequest.body || '';
if (currentBody.includes('@netlify')) {
return; // Skip if the PR body already contains a Netlify link
}
const newBody = `${currentBody}\n\n${netlifyLinks}`;
console.log('New PR body:', newBody);
// Update the pull request body
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullRequest.number,
body: newBody,
});
console.log('Netlify link added to PR body');
}
17 changes: 17 additions & 0 deletions .github/workflows/remove-canceled-netlify-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Remove Canceled Deploy Previews
on:
issue_comment:
types: [created, edited]
jobs:
cleanup:
if: github.event.comment.user.login == 'netlify[bot]' && contains(github.event.comment.body, 'Deploy Preview for') && contains(github.event.comment.body, 'canceled.')
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id
})
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"markdown.styles": [
"public/vscode_markdown.css"
]
}
21 changes: 20 additions & 1 deletion package-lock.json

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

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
"update": "for dir in sites/*; do (cd $dir && npx ncu --interactive --format group); done",
"test-all": "for dir in sites/*; do (cd $dir && npm run test); done"
},
"devDependencies": {
},
"workspaces": [
"sites/*"
]
],
"dependencies": {
"remark": "^15.0.1",
"unist-util-visit": "^5.0.0"
}
}
Loading

0 comments on commit f71af1e

Please sign in to comment.