mirror of
https://github.com/Noratrieb/actions-playground.git
synced 2026-01-16 18:05:03 +01:00
it's fine 2
This commit is contained in:
parent
1325349985
commit
157ae08827
2 changed files with 12 additions and 10 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
id: install
|
id: install
|
||||||
run: |
|
run: |
|
||||||
echo pnpm install
|
echo pnpm install
|
||||||
node ./gen-service-version.mjs
|
node ./gen-service-version.js
|
||||||
|
|
||||||
foo-service:
|
foo-service:
|
||||||
needs: [install-build]
|
needs: [install-build]
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
const child_process = require('child_process');
|
const child_process = require("child_process");
|
||||||
|
|
||||||
const services = ['bar-service', 'foo-service'];
|
const services = ["bar-service", "foo-service"];
|
||||||
|
|
||||||
function latestCommitInDirectory(dirname) {
|
function latestCommitInDirectory(dirname) {
|
||||||
return String(child_process.execSync(`git log --pretty=format:%H -n 1 -- ${dirname}`));
|
return String(
|
||||||
|
child_process.execSync(`git log --pretty=format:%H -n 1 -- ${dirname}`)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const serviceVersions = {};
|
const serviceVersions = {};
|
||||||
|
|
||||||
const currentCommit = latestCommitInDirectory('.');
|
const currentCommit = latestCommitInDirectory(".");
|
||||||
|
|
||||||
for (const service of services) {
|
for (const service of services) {
|
||||||
serviceVersions[service] = latestCommitInDirectory(service);
|
serviceVersions[service] = latestCommitInDirectory(service);
|
||||||
|
|
@ -18,7 +20,7 @@ console.log(currentCommit);
|
||||||
console.log(serviceVersions);
|
console.log(serviceVersions);
|
||||||
|
|
||||||
Object.entries(serviceVersions).forEach(([name, version]) => {
|
Object.entries(serviceVersions).forEach(([name, version]) => {
|
||||||
const skip = version === currentCommit ? 'run' : 'skip';
|
const skip = version === currentCommit ? "run" : "skip";
|
||||||
|
|
||||||
console.log(`::set-output name=${name}::${skip}`)
|
console.log(`::set-output name=${name}::${skip}`);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue