mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Update prune workflow.
This commit is contained in:
14
.github/workflows/cleanup.yml
vendored
14
.github/workflows/cleanup.yml
vendored
@@ -12,18 +12,18 @@ jobs:
|
|||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- name: Prune cancelled/skipped runs
|
- name: Prune cancelled/skipped runs
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const cancelled = await github.actions.listWorkflowRunsForRepo({
|
const cancelled = await github.rest.actions.listWorkflowRunsForRepo({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
status: 'cancelled',
|
status: 'cancelled',
|
||||||
});
|
});
|
||||||
|
|
||||||
const skipped = await github.actions.listWorkflowRunsForRepo({
|
const skipped = await github.rest.actions.listWorkflowRunsForRepo({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
for (const response of [cancelled, skipped]) {
|
for (const response of [cancelled, skipped]) {
|
||||||
for (const run of response.data.workflow_runs) {
|
for (const run of response.data.workflow_runs) {
|
||||||
console.log(`Run id ${run.id} of '${run.name}' is a cancelled/skipped run. Deleting...`);
|
console.log(`Run id ${run.id} of '${run.name}' is a cancelled/skipped run. Deleting...`);
|
||||||
await github.actions.deleteWorkflowRun({
|
await github.rest.actions.deleteWorkflowRun({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
run_id: run.id
|
run_id: run.id
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- name: Prune runs older than 3 days
|
- name: Prune runs older than 3 days
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
@@ -67,7 +67,7 @@ jobs:
|
|||||||
|
|
||||||
for (const workflow of workflows) {
|
for (const workflow of workflows) {
|
||||||
for (let page = 0; page < pages; page += 1) {
|
for (let page = 0; page < pages; page += 1) {
|
||||||
let response = await github.actions.listWorkflowRuns({
|
let response = await github.rest.actions.listWorkflowRuns({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
page: page,
|
page: page,
|
||||||
per_page: 100,
|
per_page: 100,
|
||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
for (const run of runs_to_delete) {
|
for (const run of runs_to_delete) {
|
||||||
console.log(`Run id ${run[0]} of '${run[1]}' is older than ${days_to_expiration} days. Deleting...`);
|
console.log(`Run id ${run[0]} of '${run[1]}' is older than ${days_to_expiration} days. Deleting...`);
|
||||||
try {
|
try {
|
||||||
await github.actions.deleteWorkflowRun({
|
await github.rest.actions.deleteWorkflowRun({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
run_id: run[0]
|
run_id: run[0]
|
||||||
|
Reference in New Issue
Block a user