Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Publiccode Action

This GitHub Action automatically generates and updates a publiccode.yaml file in the root of your repository, based on repository metadata. The file is updated each time a push is made to the main branch. It is basically a more advanced varsion of the publiccode softwareversion check

The Action works by running a Python script that reads repository metadata such as the repository name and description, and uses this information to create or update the publiccode.yaml file.

Usage

To use this action, simply include it as a step in your workflow file. No inputs are required.

name: My PublicCode Workflowpermissions:
contents: writeon:
push:
branches:
- mainjobs:
build:
runs-on: ubuntu-lateststeps:
- name: Update publiccode.yamluses: OpenCatalogi/publiccode-action@latest

In the above example a publiccode file is updated every time code on the main branche is touched

Info Alternatively to setting the write permission for the workflow, you can also supply the action with an access token or an SSH key; see inputs for more details.

Sending event to OpenCatalogi

This action also automatically sends an update message to the OpenCatalogi-API, so that the publiccode is reloaded by OpenCatalogi. However, the repository has to be indexed by GitHub for this to work properly the first time. This can be done by performing a search on the GitHub website in the repository, for example by searching repo:{{your org/user}}/{{your repo}} publiccode in the search bar on the GitHub website. This might take 10-15 minutes and several refreshes of the GitHub website.

Working with protected branches

It is common (and good) practise to protect the main branche of a repository from direct file editing and only allowing this trough pull requests. This will however couse the action (and workflow containing it) to fail becouse the workflow won't have the rights to actually write or create the resulting publiccode or opencatalogi files to the repository.

The sollution here is two run the action two time's 1- Once on the protected branche with the setting save set on false to prevent actual file creation or allteration 2- Once on a branche where files may actually be added without a pull request (normally dev or development) setting federlize set on false to prevent unnececcery upates to the network

Inputs

Input NameDescriptionDefault Value
nameGit URL of the remote repository to check (Optional){{ github.event.repository.name }}
descriptionGit URL of the remote repository to check (Optional)Empty String
remoterepoGit URL of the remote repository to check (Optional)Empty String
publiccodepubliccode.yml path (Optional), e.g. data/publiccode.ymlpubliccode.yml
federlizeWheter to send an update event to the federilized open catalogi networktrue
saveWheter to actually save the file to githubtrue
gitnameGit name configuration for bump commit (Optional)Open Catalogi bot
gitmailGit mail configuration for bump commit (Optional)bot@opencatalogi.nl

example ussage of the inputs

name: My PublicCode Workflowpermissions:
contents: writeon:
push:
branches:
- mainjobs:
build:
runs-on: ubuntu-lateststeps:
- name: Update publiccode.yamluses: OpenCatalogi/publiccode-action@latestwith:
name: ${{ github.head_ref }} # Git URL of the remote repository to checkdescription: ${{ github.head_ref }} # Git URL of the remote repository to checkpubliccode: docs/publiccode.yam # `publiccode.yml` pathgitname: bot myorganisation # Git name configuration for bump commitgitmail: info@myorganisation.com # Git mail configuration for bump commit

Outputs

The following outputs are provided by the action and can be used by other actions.

Output NameDescription
versionNew version of the softwareVersion field
releaseDateNew release date of the releaseDate field

Example

To use this action, simply include it as a step in your workflow file. No inputs are required.

steps:
- name: Update publiccode.yamluses: OpenCatalogi/publiccode-action@latestwith:
name: "My Codebase"description: "This is a sample repository description"publiccode: "publiccode.yml"gitname: "Open Catalogi bot"gitmail: "bot@opencatalogi.nl"

Note: Replace your-github-username with your actual GitHub username, and publiccode-update-action with the name of the repository where this action is hosted.

Tips

Need a quick way to present your project online but don't have the time te create a dedicated website? Combine the publiccode code actions with the product page action to get an instant website for you project.

name: My PublicCode Workflowpermissions:
contents: writeon:
push:
branches:
- mainjobs:
build:
runs-on: ubuntu-lateststeps:
- name: Update publiccode.yamluses: OpenCatalogi/publiccode-action@latest
- name: Deploy Product Github Pageuses: OpenCatalogi/productpage-action@latest

Read more about the product page action

Architecture

Why Python?

Python is natively supported by GitHub actions' underlaying containers and therefore very quick

Asumptions

We follow the "get data from the source" principle, in practice for this action that means that we set the repository as the source. So any settings in the repository (e.g. name and description) will overwrite the values already pressent in your publiccode.

Please note that this action does not handle errors or exceptions while reading metadata or writing to publiccode.yaml. You should ensure that your repository is properly set up to avoid any issues. For example, make sure that your repository name and description are not empty.

Maintainers

This software is maintained by Conduction b.v.

License

© 2023 Conduction B.V.

Licensed under the EUPL. The version control system provides attribution for specific lines of code.

Remarks

This GitHub Action is published in the GitHub Marketplace. As such, you can find the Terms of Service here. Also, here you can find the GitHub Marketplace Developer Agreement.

About

This GitHub Action automatically generates and updates a publiccode.yaml file in the root of your repository, based on repository metadata. The file is updated each time a push is made to the main branch.

Resources

Contributing

Security policy

Stars

3 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages