https://github.com/cicirello/python-github-action-template

A template repository for GitHub Actions implemented in Python

https://github.com/cicirello/python-github-action-template

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

docker github-actions python template-repository

Keywords from Contributors

projection archival sequences generic interactive binomial-random-variable evolutionary-algorithms randomization genetic-algorithm standardization
Last synced: 5 months ago · JSON representation

Repository

A template repository for GitHub Actions implemented in Python

Basic Info
  • Host: GitHub
  • Owner: cicirello
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 29.3 KB
Statistics
  • Stars: 27
  • Watchers: 1
  • Forks: 16
  • Open Issues: 0
  • Releases: 0
Topics
docker github-actions python template-repository
Created over 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License

README.md

python-github-action-template

A template repository for GitHub Actions implemented in Python.

Files in This Template

README.md

Obviously, update this to reflect your GitHub Action.

LICENSE

Choose your license. This template is licensed under the MIT license, so that is what the LICENSE file indicates. If you use this template, either keep the MIT license or update to something compatible.

CHANGELOG.md

It is a good idea to keep a changelog, so we've provided a template of a changelog within this template repository.

dockerignore

The .dockerignore is set up as an allowlist, initially allowing only the Dockerfile and the entrypoint.py. If you rename entrypoint.py, be sure to edit the .dockerignore (or likewise, if your GitHub Action needs any additional files while running).

gitignore

The .gitignore includes Python related things you likely won't want to store in git (update as appropriate).

Dockerfile

The Dockerfile in this template pulls an image that includes Python, and then sets the entrypoint to entrypoint.py. If you rename entrypoint.py (or need additional files) then don't forget to edit the Dockerfile.

Additionally, you will need to decide which docker image to start with. There are two that I commonly use that I also maintain, both of which can be pulled from either Docker Hub or the Github Container Registry. Uncomment/comment as appropriate in the Dockerfile as desired. Or if you'd rather not pull one of my images, you can see the source repository for the details. Here are the options found in the Dockerfile comments: * An image with Alpine Linux and Python only to keep image small for fast loading: FROM cicirello/pyaction-lite:3 * An image with Alpine Linux, Python, and git, which is also relatively small: FROM cicirello/pyaction:3 * Beginning with version 4, the pyaction image no longer uses Alpine as the base. It now uses python:3-slim, which is built on Debian (the slim version is small but not nearly as small as Alpine), on which we have installed the GitHub CLI : FROM cicirello/pyaction:4 * To pull from the Github Container Registry instead of Docker Hub: FROM ghcr.io/cicirello/pyaction:4 (and likewise for the other images).

The source repositories for these images: * https://github.com/cicirello/pyaction-lite * https://github.com/cicirello/pyaction

action.yml

Edit the action.yml file to define your action's inputs and outputs (see examples in the file).

entrypoint.py

You can rename this Python file to whatever you want, provided you change its name in all other files above that reference it. The template version includes examples of accessing Action inputs and producing outputs. Make sure it is executable (the one in the template is already executable). If you simply rename the file, it should keep the executable bit set. However, if you delete it and replace it with a new file, you'll need to set it executable.

tests/tests.py

Python unit test cases could go here.

tests/integration.py

Ideally, after unit testing the Python functions, methods, etc (see above), you should also test the action itself. This involves running the action locally in a workflow within the action's own repository. If the action generates any files, or alters any files, then you can add a step to run the tests in tests/integration.py to validate the action's output. Although you don't necessarily need to do this with Python, it may be convenient since Python would already be configured in your workflow.

.github/dependabot.yml

The template repository enables GitHub's dependabot for keeping dependencies up to date (it generates pull requests when new versions are found). The template file enables dependabot for Docker (since we're using Docker for the GitHub Action), and GitHub Actions to keep any workflow dependencies up to date.

.github/workflows/build.yml

This workflow runs on pushes and pull requests against the main branch. It executes all Python unit tests (see tests/tests.py section above). It verifies that the docker image for the GitHub Action builds. It then executes the GitHub Action locally against the action's own repository, as an integration test. Finally, it executes the tests in tests/integration.py (see earlier section) to validate any files created or edited by the integration test. You might also add a step to the workflow to test that outputs are correct as well.

.github/workflows/major-release-num.yml

This workflow maintains a major release tag (e.g., v1 if current release is v1.x.y). It runs on each release and either creates the tag (if this is the first release of a new major release number) or moves it if this is a minor or patch level release. IMPORTANT: You must edit this with your name, etc in the commit and push step.

Owner

  • Name: Vincent A. Cicirello
  • Login: cicirello
  • Kind: user
  • Location: Galloway, NJ
  • Company: Stockton University

Vincent A. Cicirello is a researcher in AI, evolutionary computation, and swarm intelligence.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 2
  • Pull request review event: 1
  • Pull request event: 4
  • Fork event: 7
  • Create event: 3
Last Year
  • Issues event: 1
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 1
  • Push event: 2
  • Pull request review event: 1
  • Pull request event: 4
  • Fork event: 7
  • Create event: 3

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 42
  • Total Committers: 2
  • Avg Commits per committer: 21.0
  • Development Distribution Score (DDS): 0.119
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Vincent A. Cicirello c****o 37
dependabot[bot] 4****] 5

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 3
  • Total pull requests: 11
  • Average time to close issues: 23 days
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.18
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 7
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: 2 months
  • Average time to close pull requests: 5 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cicirello (2)
  • Fran-Rg (1)
Pull Request Authors
  • dependabot[bot] (8)
  • cicirello (5)
  • SamyakPnG (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels
dependencies (8) github_actions (8)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 0
github actions: cicirello/python-github-action-template

BRIEF DESCRIPTION OF YOUR ACTION

  • License: mit
  • Versions: 0
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 0.0%
Stargazers count: 14.2%
Forks count: 14.7%
Average: 18.0%
Dependent repos count: 42.9%
Last synced: 6 months ago

Dependencies

.github/workflows/build.yml actions
  • ./ * composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/major-release-num.yml actions
  • actions/checkout v3 composite
action.yml actions
  • Dockerfile * docker
Dockerfile docker
  • cicirello/pyaction 4 build