mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-04 05:15:39 +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
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Prune cancelled/skipped runs
 | 
			
		||||
        uses: actions/github-script@v4
 | 
			
		||||
        uses: actions/github-script@v6
 | 
			
		||||
        with:
 | 
			
		||||
          github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
 | 
			
		||||
          script: |
 | 
			
		||||
            const cancelled = await github.actions.listWorkflowRunsForRepo({
 | 
			
		||||
            const cancelled = await github.rest.actions.listWorkflowRunsForRepo({
 | 
			
		||||
              owner: context.repo.owner,
 | 
			
		||||
              per_page: 100,
 | 
			
		||||
              repo: context.repo.repo,
 | 
			
		||||
              status: 'cancelled',
 | 
			
		||||
            });
 | 
			
		||||
            
 | 
			
		||||
            const skipped = await github.actions.listWorkflowRunsForRepo({
 | 
			
		||||
            const skipped = await github.rest.actions.listWorkflowRunsForRepo({
 | 
			
		||||
              owner: context.repo.owner,
 | 
			
		||||
              per_page: 100,
 | 
			
		||||
              repo: context.repo.repo,
 | 
			
		||||
@@ -33,7 +33,7 @@ jobs:
 | 
			
		||||
            for (const response of [cancelled, skipped]) {
 | 
			
		||||
              for (const run of response.data.workflow_runs) {
 | 
			
		||||
                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,
 | 
			
		||||
                  repo: context.repo.repo,
 | 
			
		||||
                  run_id: run.id
 | 
			
		||||
@@ -42,7 +42,7 @@ jobs:
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
      - name: Prune runs older than 3 days
 | 
			
		||||
        uses: actions/github-script@v4
 | 
			
		||||
        uses: actions/github-script@v6
 | 
			
		||||
        with:
 | 
			
		||||
          github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
 | 
			
		||||
          script: |
 | 
			
		||||
@@ -67,7 +67,7 @@ jobs:
 | 
			
		||||
            
 | 
			
		||||
            for (const workflow of workflows) {
 | 
			
		||||
              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,
 | 
			
		||||
                  page: page,
 | 
			
		||||
                  per_page: 100,
 | 
			
		||||
@@ -88,7 +88,7 @@ jobs:
 | 
			
		||||
            for (const run of runs_to_delete) {
 | 
			
		||||
              console.log(`Run id ${run[0]} of '${run[1]}' is older than ${days_to_expiration} days. Deleting...`);
 | 
			
		||||
              try {
 | 
			
		||||
                await github.actions.deleteWorkflowRun({
 | 
			
		||||
                await github.rest.actions.deleteWorkflowRun({
 | 
			
		||||
                  owner: context.repo.owner,
 | 
			
		||||
                  repo: context.repo.repo,
 | 
			
		||||
                  run_id: run[0]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user