Skip to content

Commit

Permalink
馃摝 build: V1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
h7ml committed May 3, 2024
1 parent 46c0bee commit 7360bb6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/delete-workflow-run-logs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy
name: delete-workflow-run-logs
on:
pull_request:
branches:
Expand All @@ -8,15 +8,15 @@ on:
branches:
- main
jobs:
deploy:
delete-workflow-run-logs:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
id: delete-workflow-run-logs
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
per_page: 100
expire_time: 7d
status: completed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">deleteWorkflowRunLogs</h1>
<p>
<a href="https://www.npmjs.com/package/@dext7r/delete-workflow-run-logs" target="_blank">
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000">
<img alt="Version" src="https://img.shields.io/badge/version-1.0.1-blue.svg?cacheSeconds=2592000">
</a>
<a href="https://github.com/dext7r/deleteWorkflowRunLogs/actions/workflows/delete-workflow-run-logs.yml" target="_blank">
<img alt="GitHub Workflow Status" src="https://github.com/dext7r/deleteWorkflowRunLogs/actions/workflows/delete-workflow-run-logs.yml/badge.svg">
Expand Down Expand Up @@ -39,14 +39,14 @@ jobs:

steps:
- name: Run Push Notifications action
uses: dext7r/delete-workflow-run-logs@v1.0.0
uses: dext7r/delete-workflow-run-logs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
per_page: 100
expire_time: 7d
status: completed
repo: ${{ github.repository }}
owner: ${{ github.actor }}
repo: ${{ github.repository.repo }}
owner: ${{ github.repository.owner }}
```

## 鍙傛暟
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'deleteWorkflowRunLogs-action'
description: 'Push notifications to multiple platforms.'
version: 'v1.0.0'
version: 'v1.0.1'
author: 'h7ml <h7ml@qq.com>'

branding:
icon: 'message-circle'
color: 'green'
version: 'v1.0.0'
version: 'v1.0.1'
author: 'h7ml'

inputs:
Expand All @@ -28,11 +28,11 @@ inputs:
repo:
description: 'The repository to fetch runs from.'
required: false
default: ${{ github.repository }}
default: ${{ github.repository.name }}
owner:
description: 'The owner of the repository.'
required: false
default: ${{ github.actor }}
default: ${{ github.repository_owner }}
runs:
using: 'node20'
main: './dist/index.js'
22 changes: 11 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29700,7 +29700,7 @@ class Scheduler {
*/
async add(task) {
if (this.count >= this.max)
await new Promise(resolve => this.queue.push(resolve)); // 娣诲姞浠诲姟鍒伴槦鍒椾腑
await new Promise((resolve) => this.queue.push(resolve)); // 娣诲姞浠诲姟鍒伴槦鍒椾腑
this.count++;
this.running.push(task); // 娣诲姞浠诲姟鍒版鍦ㄨ繍琛岀殑浠诲姟鍒楄〃
const res = await task.run(); // 杩愯浠诲姟
Expand Down Expand Up @@ -29817,7 +29817,7 @@ async function getWorkflowRuns(props) {
branch,
page,
});
const { data: { workflow_runs = [] } } = response;
const { data: { workflow_runs = [] }, } = response;
allWorkflowRuns = allWorkflowRuns.concat(workflow_runs);
total_count += workflow_runs.length;
if (workflow_runs.length < per_page)
Expand Down Expand Up @@ -29850,7 +29850,7 @@ exports.getWorkflowRuns = getWorkflowRuns;
* @returns Promise<void>
*/
async function deleteWorkflowRunLogs(props) {
const { token, repo, owner, event, status, per_page, branch, expire_time, } = props;
const { token, repo, owner, event, status, per_page, branch, expire_time } = props;
const octokit = new rest_1.Octokit({ auth: `token ${token}` });
try {
const { total_count, workflow_runs } = await getWorkflowRuns({
Expand Down Expand Up @@ -29890,13 +29890,12 @@ exports.config = void 0;
const github_1 = __nccwpck_require__(5942);
const utils_1 = __nccwpck_require__(442);
exports.config = {
token: (0, utils_1.getInput)('GITHUB_TOKEN'),
repository: (0, utils_1.getInput)('GITHUB_REPOSITORY'),
per_page: Number.parseInt((0, utils_1.getInput)('PER_PAGE') || '100', 10),
expire_time: (0, utils_1.getInput)('EXPIRE_TIME') || '7d',
status: (0, utils_1.getInput)('STATUS') || 'completed',
repo: (0, utils_1.getInput)('REPO') || github_1.context?.repo?.repo,
owner: (0, utils_1.getInput)('OWNER') || github_1.context?.repo?.owner,
token: (0, utils_1.getInput)('token'),
per_page: Number.parseInt((0, utils_1.getInput)('per_page') || '100', 10),
expire_time: (0, utils_1.getInput)('expire_time') || '7d',
status: (0, utils_1.getInput)('status') || 'completed',
repo: (0, utils_1.getInput)('repo') || github_1.context?.repo?.repo,
owner: (0, utils_1.getInput)('owner') || github_1.context?.repo?.owner,
};


Expand Down Expand Up @@ -29930,8 +29929,9 @@ exports.getInput = getInput;
function getExpiredTimestamp(expireTime) {
const now = new Date();
const expiredDate = new Date(now);
if (expireTime.endsWith('y'))
if (expireTime.endsWith('y')) {
expiredDate.setFullYear(expiredDate.getFullYear() - Number.parseInt(expireTime));
}
if (expireTime.endsWith('m'))
expiredDate.setMonth(expiredDate.getMonth() - Number.parseInt(expireTime));
if (expireTime.endsWith('d'))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dext7r/delete-workflow-run-logs",
"version": "1.0.0",
"version": "1.0.1",
"description": "A GitHub Action to delete logs of a workflow run",
"repository": {
"type": "git",
Expand Down
13 changes: 6 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import type { WorkflowRunLogsProps } from './type'
import { getInput } from './utils'

export const config: WorkflowRunLogsProps = {
token: getInput('GITHUB_TOKEN'),
repository: getInput('GITHUB_REPOSITORY'),
per_page: Number.parseInt(getInput('PER_PAGE') || '100', 10),
expire_time: getInput('EXPIRE_TIME') || '7d',
status: (getInput('STATUS') as WorkflowRunLogsProps['status']) || 'completed',
repo: getInput('REPO') || context?.repo?.repo,
owner: getInput('OWNER') || context?.repo?.owner,
token: getInput('token'),
per_page: Number.parseInt(getInput('per_page') || '100', 10),
expire_time: getInput('expire_time') || '7d',
status: (getInput('status') as WorkflowRunLogsProps['status']) || 'completed',
repo: getInput('repo') || context?.repo?.repo,
owner: getInput('owner') || context?.repo?.owner,
}

1 comment on commit 7360bb6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was made with the following details:

  • Commit ID: 7360bb6
  • Commit Message: 馃摝 build: V1.0.1
  • Run_id: 8932949861
  • Repository: dext7r/deleteWorkflowRunLogs
  • Commit Time: 2024-05-03T09:43:54+08:00
  • Commit Author: h7ml
  • Commit Author Email: h7ml@qq.com
  • Commit Author Date:
  • Commit Committer: h7ml
  • Commit Committer Email: h7ml@qq.com

Please sign in to comment.