Skip to content

Commit

Permalink
Make the new workflows available on main, so that we can see them in …
Browse files Browse the repository at this point in the history
…the list and test them on the feature branch...
  • Loading branch information
LanDinh committed Jan 23, 2023
1 parent f33aed1 commit 3974d43
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/clean-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Clean Cache
on:
workflow_dispatch:
inputs:
commit:
description: the commit for which to
required: true
type: string
jobs:
# Delete workflow runs inside the workflow to clean it up.
clean-cache:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Clean up cache.
uses: ./.github/actions/clean-cache
34 changes: 34 additions & 0 deletions .github/workflows/delete-old-workflow-runs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Delete Old Workflow Runs
on:
workflow_dispatch:
inputs:
workflow:
description: the workflow that needs to be deleted
required: true
type: string
jobs:
# Delete workflow runs inside the workflow to clean it up.
delete-workflow:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Clean up old workflow data.
uses: actions/github-script@v6
with:
script: |
console.log('Start deletion of workflow runs.')
const workflow_runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: '${{ inputs.workflow }}',
})
for (const workflow_run of workflow_runs.data.workflow_runs) {
console.log(workflow_run)
github.rest.actions.deleteWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: workflow_run.id,
})
}
console.log('Finished deletion of workflow runs.')

0 comments on commit 3974d43

Please sign in to comment.