Skip to content

Commit 754091c

Browse files
committed
Commit message and details from config
1 parent 333a60f commit 754091c

2 files changed

Lines changed: 42 additions & 11 deletions

File tree

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,29 @@ permissions:
4343
| `gitname` | Git name configuration for bump commit (Optional) | `Open Catalogi bot` |
4444
| `gitmail` | Git mail configuration for bump commit (Optional) | `bot@opencatalogi.nl` |
4545

46+
example ussage of the inputs
47+
48+
````yaml
49+
name: My PublicCode Workflow
50+
51+
on:
52+
push:
53+
branches:
54+
- main
55+
56+
jobs:
57+
build:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Update publiccode.yaml
61+
uses: OpenCatalogi/publiccode-action@1
62+
with:
63+
name: ${{ github.head_ref }} # Git URL of the remote repository to check
64+
description: ${{ github.head_ref }} # Git URL of the remote repository to check
65+
publiccode: docs/publiccode.yam # `publiccode.yml` path
66+
gitname: bot myorganisation # Git name configuration for bump commit
67+
gitmail: info@myorganisation.com # Git mail configuration for bump commit
68+
````
4669

4770
## Outputs
4871
The following outputs are provided by the action and can be used by other actions.

action.yaml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,26 @@ inputs:
1818
type: string
1919
default: 'publiccode.yaml'
2020
opencatalogi:
21-
description: 'publiccode.yaml path'
21+
description: 'create an opencatalogi file instead of a publiccode'
2222
required: false
2323
type: boolean
2424
default: false
25-
gitname:
26-
description: 'Git name configuration for bump commit'
25+
# git configuration
26+
git-name:
27+
description: 'Git name configuration for the commit'
2728
required: false
2829
type: string
2930
default: 'Open Catalogi bot'
30-
gitmail:
31-
description: 'Git mail configuration for bump commit'
31+
git-mail:
32+
description: 'Git mail configuration for the commit'
3233
required: false
3334
type: string
3435
default: 'bot@opencatalogi.nl'
36+
git-commit-message:
37+
description: 'The description for the commit'
38+
required: false
39+
type: string
40+
default: ${{ github.event.repository.html_url }}
3541

3642
outputs:
3743
version:
@@ -224,20 +230,22 @@ runs:
224230
if: (!contains(github.repository, '.github'))
225231
shell: bash
226232
run: |
227-
git config --local user.email "action@github.com"
228-
git config --local user.name "GitHub Action"
233+
git config --local user.email "${{ inputs.git-mail }}"
234+
git config --local user.name "${{ inputs.git-name }}"
235+
git pull
229236
git add publiccode.yaml
230-
git commit -m "${{ github.workflow }}" || echo "No changes to commit"
237+
git commit -m "${{ inputs.git-commit-message }}" || echo "No changes to commit"
231238
git push
232239
# Commit changes if it is an organisation repository
233240
- name: Commit changes
234241
if: (contains(github.repository, '.github'))
235242
shell: bash
236243
run: |
237-
git config --local user.email "action@github.com"
238-
git config --local user.name "GitHub Action"
244+
git config --local user.email "${{ inputs.git-mail }}"
245+
git config --local user.name "${{ inputs.git-name }}"
246+
git pull
239247
git add opencatalogi.yaml
240-
git commit -m "${{ github.workflow }}" || echo "No changes to commit"
248+
git commit -m "${{ inputs.git-commit-message }}" || echo "No changes to commit"
241249
git push
242250
# Post Repository URL to OpenCatalogi API
243251
- name: Post Repository URL to OpenCatalogi API

0 commit comments

Comments
 (0)