Skip to content

Commit bdc9432

Browse files
committed
[doc] update
1 parent 5a4bdc0 commit bdc9432

File tree

4 files changed

+224
-2
lines changed

4 files changed

+224
-2
lines changed

.github/workflows/gha_clean.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2121
- name: check self
2222
run: |
23-
python3 ./gh_workflow_runs_delete.py -d -r grindsa/github_actions_clean -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2
23+
python3 ./gh_workflow_runs_delete.py -d -r grindsa/github_actions_clean -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }}
2424
- name: check a2c
2525
run: |
2626
python3 ./gh_workflow_runs_delete.py -d -r grindsa/acme2certifier -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2

.github/workflows/markdown-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# workflow to run the acme2certifier unittest suite
2+
3+
name: Markdown check
4+
5+
on:
6+
push:
7+
pull_request:
8+
branches: [ devel ]
9+
schedule:
10+
# * is a special character in YAML so you have to quote this string
11+
- cron: '0 2 * * 6'
12+
13+
jobs:
14+
markdown-check:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@master
18+
- uses: gaurav-nelson/github-action-markdown-link-check@v1
19+
- name: Lint changelog file root
20+
uses: avto-dev/markdown-lint@v1
21+
with:
22+
args: '*.md'

CONTRIBUTING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!-- markdownlint-disable MD013 -->
2+
# Contributing
3+
4+
When contributing to this repository, please first discuss the change you wish to make via issue,
5+
email, or any other method with the owners of this repository before making a change.
6+
7+
Please note we have a code of conduct, please follow it in all your interactions with the project.
8+
9+
## Pull Request Process
10+
11+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
12+
build.
13+
2. Update the README.md with details of changes to the interface, this includes new environment
14+
variables, exposed ports, useful file locations and container parameters.
15+
3. Increase the version numbers in any examples files and the README.md to the new version that this
16+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
17+
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
18+
do not have permission to do that, you may request the second reviewer to merge it for you.
19+
20+
## Code of Conduct
21+
22+
### Our Pledge
23+
24+
In the interest of fostering an open and welcoming environment, we as
25+
contributors and maintainers pledge to making participation in our project and
26+
our community a harassment-free experience for everyone, regardless of age, body
27+
size, disability, ethnicity, gender identity and expression, level of experience,
28+
nationality, personal appearance, race, religion, or sexual identity and
29+
orientation.
30+
31+
### Our Standards
32+
33+
Examples of behavior that contributes to creating a positive environment
34+
include:
35+
36+
- Using welcoming and inclusive language
37+
- Being respectful of differing viewpoints and experiences
38+
- Gracefully accepting constructive criticism
39+
- Focusing on what is best for the community
40+
- Showing empathy towards other community members
41+
42+
Examples of unacceptable behavior by participants include:
43+
44+
- The use of sexualized language or imagery and unwelcome sexual attention or
45+
advances
46+
- Trolling, insulting/derogatory comments, and personal or political attacks
47+
- Public or private harassment
48+
- Publishing others' private information, such as a physical or electronic
49+
address, without explicit permission
50+
- Other conduct which could reasonably be considered inappropriate in a
51+
professional setting
52+
53+
### Our Responsibilities
54+
55+
Project maintainers are responsible for clarifying the standards of acceptable
56+
behavior and are expected to take appropriate and fair corrective action in
57+
response to any instances of unacceptable behavior.
58+
59+
Project maintainers have the right and responsibility to remove, edit, or
60+
reject comments, commits, code, wiki edits, issues, and other contributions
61+
that are not aligned to this Code of Conduct, or to ban temporarily or
62+
permanently any contributor for other behaviors that they deem inappropriate,
63+
threatening, offensive, or harmful.
64+
65+
### Scope
66+
67+
This Code of Conduct applies both within project spaces and in public spaces
68+
when an individual is representing the project or its community. Examples of
69+
representing a project or community include using an official project e-mail
70+
address, posting via an official social media account, or acting as an appointed
71+
representative at an online or offline event. Representation of a project may be
72+
further defined and clarified by project maintainers.
73+
74+
### Enforcement
75+
76+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
77+
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
78+
complaints will be reviewed and investigated and will result in a response that
79+
is deemed necessary and appropriate to the circumstances. The project team is
80+
obligated to maintain confidentiality with regard to the reporter of an incident.
81+
Further details of specific enforcement policies may be posted separately.
82+
83+
Project maintainers who do not follow or enforce the Code of Conduct in good
84+
faith may face temporary or permanent repercussions as determined by other
85+
members of the project's leadership.
86+
87+
### Attribution
88+
89+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
90+
available at [http://contributor-covenant.org/version/1/4][version]
91+
92+
[homepage]: http://contributor-covenant.org
93+
[version]: http://contributor-covenant.org/version/1/4/

README.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,109 @@
11
<!-- markdownlint-disable MD013 -->
2-
# github_workflow_clean
2+
# gh_workflow_runs_delete.py
3+
4+
`gh_workflow_runs_delete.py` is a small python script helping you to "mass delete" Github Actions workflow runs as such a feature isn't available in the Web base Actions UI.
5+
6+
It uses the [WorkFlow Runs API](https://docs.github.com/en/rest/reference/actions#workflow-runs) allowing `delete` operations by using the `/repos/{owner}/{repo}/actions/runs` endpoint.
7+
8+
By default the script scans a repository to get a list of branches and deletes all workflow runs except the ones belonging ot that latest commit per branch. The list of branches as well as the amount of commits to be kept can be adjusted.
9+
10+
## pre-requisite
11+
12+
You need a personal access token with the following permissions:
13+
14+
- repo
15+
- workflow
16+
- read:org
17+
18+
## Installation
19+
20+
- download and unpack the archive
21+
- install dependencies
22+
23+
```bash
24+
> pip install -r requirements.txt
25+
```
26+
27+
## Usage
28+
29+
```bash
30+
grindsa@lola:~$ python3 ./gh_workflow_runs_delete.py -r {owner}/{repo} -t {TOKEN} -u {github_user}
31+
```
32+
33+
Below the list of command line options
34+
35+
```bash
36+
grindsa@lola:~$ py gh_actions_clean> py .\gh_workflow_runs_delete.py -h
37+
usage: gh_workflow_runs_delete.py [-h] [-d] [-r REPONAME] [-u USERNAME] [-t TOKEN] [-c COMMITS]
38+
[--branchlist BRANCHLIST]
39+
40+
gh_workflow_runs_delete.py - delete github action logs and artifacts
41+
42+
optional arguments:
43+
-h, --help show this help message and exit
44+
-d, --debug debug mode
45+
-r REPONAME, --reponame REPONAME
46+
repositoryname
47+
-u USERNAME, --username USERNAME
48+
username
49+
-t TOKEN, --token TOKEN
50+
token
51+
-c COMMITS, --commits COMMITS
52+
number of commits to keep
53+
--branchlist BRANCHLIST
54+
list of branches
55+
grindsa@lola:~$
56+
```
57+
58+
## Usage as part of a Github workflow
59+
60+
I created an [example workflow](https://github.com/grindsa/gh_workflow_runs_clean/blob/main/.github/workflows/gha_clean.yml) which is cleaning up my repositories once a week.
61+
62+
```YAML
63+
# workflow to clean github workflow runs for my repositories
64+
65+
name: Github WF Runs Clean
66+
on:
67+
push:
68+
schedule:
69+
# * is a special character in YAML so you have to quote this string
70+
- cron: '0 2 * * 6'
71+
72+
jobs:
73+
gha_clean:
74+
runs-on: ubuntu-latest
75+
name: Github WF Runs Clean
76+
steps:
77+
- uses: actions/checkout@v2
78+
- name: Install dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
pip install pytest
82+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
83+
- name: check self
84+
run: |
85+
python3 ./gh_workflow_runs_delete.py -d -r grindsa/github_actions_clean -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2
86+
- name: check a2c
87+
run: |
88+
python3 ./gh_workflow_runs_delete.py -d -r grindsa/acme2certifier -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2
89+
- name: check est_proxy
90+
run: |
91+
python3 ./gh_workflow_runs_delete.py -d -r grindsa/est_proxy -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2
92+
- name: check dkb-robo
93+
run: |
94+
python3 ./gh_workflow_runs_delete.py -d -r grindsa/dkb-robo -t ${{ secrets.GH_TOKEN }} -u ${{ secrets.GH_USER }} -c 2
95+
96+
```
97+
98+
## Contributing
99+
100+
Please read [CONTRIBUTING.md](https://github.com/grindsa/gh_workflow_runs_clean/blob/main/CONTRIBUTING.md) for details on my code of conduct, and the process for submitting pull requests.
101+
Please note that I have a life besides programming. Thus, expect a delay in answering.
102+
103+
## Versioning
104+
105+
I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/grindsa/gh_workflow_runs_clean/tags).
106+
107+
## License
108+
109+
This project is licensed under the GPLv3 - see the [LICENSE.md](https://github.com/grindsa/gh_workflow_runs_clean/blob/main/LICENSE) file for details

0 commit comments

Comments
 (0)