Skip to content

Commit

Permalink
Merge branch 'main' into deprecate-checkmax-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu authored Oct 8, 2024
2 parents 57121a0 + 1fa03ae commit 27a7e4f
Show file tree
Hide file tree
Showing 121 changed files with 8,905 additions and 3,516 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"
]
}
4 changes: 4 additions & 0 deletions bin/build-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ async function getKeysWithPrefixes(prefixes) {
let client = new S3Client({
region: 'eu-west-1',
signer: { sign: async (request) => request },
credentials: {
accessKeyId: '',
secretAccessKey: '',
},
});
const keys = [];
const commonPrefixes = [];
Expand Down
Loading

0 comments on commit 27a7e4f

Please sign in to comment.