Skip to content

chore(deps): bump semver from 5.7.1 to 5.7.2 #2534

chore(deps): bump semver from 5.7.1 to 5.7.2

chore(deps): bump semver from 5.7.1 to 5.7.2 #2534

Workflow file for this run

name: PR Check
on:
pull_request:
jobs:
generate-changeset:
runs-on: ubuntu-latest
if: github.actor == 'penicillin0' || github.actor == 'dependabot[bot]' || github.actor == 'takurinton'
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.FLUCT_MEMBER_GITHUB_TOKEN }}
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: install
run: make -f ci.mk install
- name: git config
run: |
git config --local user.name ${{ secrets.FLUCT_MEMBER_GITHUB_USER_NAME }}
git config --local user.email ${{ secrets.FLUCT_MEMBER_GITHUB_USER_EMAIL }}
- name: generate changeset
uses: actions/github-script@v6
with:
script: |
const { promises: fs } = require('fs');
// Parses package.json files and returns the package names
async function getPackagesNames(files) {
const names = [];
for (const file of files) {
const data = JSON.parse(await fs.readFile(file, 'utf8'));
if (!data.private) {
names.push(data.name);
}
}
return names;
}
async function createChangeset(fileName, commitMessage, packages) {
const pkgs = packages.map(pkg => `'${pkg}': patch`).join('\n');
const message = commitMessage.replace(/([bB])ump ([\S]+)/, '$1ump `$2`').trim();
const body = `---\n${pkgs}\n---\n\n${message}\n`;
await fs.writeFile(fileName, body);
}
// const branch = await exec.getExecOutput('git branch --show-current');
// if (!branch.stdout.startsWith('dependabot/')) {
// console.log('Not a dependabot branch, skipping');
// return;
// }
const diffOutput = await exec.getExecOutput('git diff origin/master...HEAD --name-only');
const diffFiles = diffOutput.stdout.split('\n');
if (diffFiles.find(f => f.startsWith('.changeset'))) {
console.log('Changeset already exists, skipping');
return;
}
diffFiles.forEach(file => console.log(`- ${file}`));
const files = diffFiles
.filter(file => file !== 'package.json' || file !== 'yarn.lock') // skip root package.json and yarn.lock
.filter(file => file.includes('package.json'));
files.forEach(file => console.log(`- ${file}`));
const packageNames = await getPackagesNames(files);
packageNames.forEach(pkg => console.log(`- ${pkg}`));
if (!packageNames.length) {
console.log('No package.json changes to published packages, skipping');
return;
}
const { stdout: shortHash } = await exec.getExecOutput('git rev-parse --short HEAD');
const fileName = `.changeset/dependabot-${shortHash.trim()}.md`;
const { stdout: commitMessage } = await exec.getExecOutput('git show --pretty=format:%s -s HEAD');
await createChangeset(fileName, commitMessage, packageNames);
await exec.exec('git', ['add', fileName]);
await exec.exec('git commit -C HEAD --amend --no-edit');
await exec.exec('git push --force');
test-lint-and-build:
runs-on: ubuntu-latest
needs: [generate-changeset]
if: always() && (needs.generate-changeset.result == 'skipped' || needs.generate-changeset.result == 'success')
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: install
run: make -f ci.mk install
- name: check changesets
run: make -f ci.mk check_changesets
- name: lint
run: make -f ci.mk lint
- name: test
run: make -f ci.mk test
- name: build
run: make -f ci.mk build