Skip to content

Commit

Permalink
ci: refactor project configuration and workflows
Browse files Browse the repository at this point in the history
- Create reset-run-number.yml
  • Loading branch information
Alex870521 committed Nov 2, 2024
1 parent cb431e0 commit 79b0cb1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report
name: coverage-report-${{ matrix.python-version }}-${{ github.sha }}
path: coverage.xml
if-no-files-found: error
47 changes: 47 additions & 0 deletions .github/workflows/reset-run-number.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# .gitHub/workflows/reset-run-number.yml
name: Reset Run Number
on:
workflow_dispatch:
inputs:
workflow_name:
description: '選擇要重置的工作流程'
required: true
type: choice
options:
- 'pytest.yml'
- 'publish.yml'
- 'reset-run-number.yml'

jobs:
reset:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Reset run number
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const workflow = '${{ github.event.inputs.workflow_name }}';
console.log(`Resetting run number for workflow: ${workflow}`);
// 獲取所有運行
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow,
});
// 刪除所有運行
console.log(`Found ${runs.data.total_count} runs to delete`);
for (const run of runs.data.workflow_runs) {
console.log(`Deleting run #${run.run_number}`);
await github.rest.actions.deleteWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
}
console.log('All runs deleted. Next run will start from #1');
2 changes: 1 addition & 1 deletion AeroViz/rawDataReader/script/EPA.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _raw_reader(self, file):
on_bad_lines='skip')

if len(df.groupby('測站')) > 1:
raise ValueError(f'Multiple stations found in the file: {df['測站'].unique()}')
raise ValueError(f"Multiple stations found in the file: {df['測站'].unique()}")
else:
if '測站' in df.columns:
df.drop(columns=['測站'], inplace=True)
Expand Down

0 comments on commit 79b0cb1

Please sign in to comment.