-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (57 loc) · 2.04 KB
/
Copy pathversions.yml
File metadata and controls
59 lines (57 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: version
on:
workflow_dispatch:
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.TOKEN }}
- uses: actions/github-script@v8
id: data
with:
github-token: ${{ secrets.TOKEN }}
script: |
const data = require('./versions.json')
console.log(data)
let results = [];
for (const info of data) {
const {repo} = info
console.log('Looking for repository:', repo);
const wf = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo,
branch: 'master',
per_page: '1',
event: 'schedule'
})
console.log(wf.data.workflow_runs);
const conclusion = wf.data.workflow_runs[0].conclusion;
console.log(conclusion);
if (conclusion != 'success') {
core.setFailed('Last schedule does not work: ' + repo);
return;
}
const release = await github.rest.repos.getLatestRelease({owner: context.repo.owner, repo});
const version = release.data.tag_name.substring(1);
console.log(release.data.tag_name);
results.push({repo, version});
}
console.log("results",results)
const json = JSON.stringify(results.sort(), null, 2)
console.log(json);
core.setOutput("json", json);
const fs = require('fs')
fs.writeFile('versions.json', json, (err) => {
if (err) throw err;
console.log('The file has been saved!');
})
- uses: stefanzweifel/git-auto-commit-action@v7
id: commit
with:
commit_message: Apply version changes
- name: "Run if changes have been detected"
if: steps.commit.outputs.changes_detected != 'true'
run: exit 1