Skip to content

Commit 8a79e72

Browse files
authored
changelog workflow update (#117)
* changelog: create github action, changelog should be required for roles, playbooks updated
1 parent d617085 commit 8a79e72

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: ansible_validate_changelog
2+
description: Ensure a valid changelog has been added to the pull request.
3+
4+
inputs:
5+
path:
6+
description: |
7+
Path to the collection to validate changelog from.
8+
required: false
9+
default: "."
10+
base_ref:
11+
description: The pull request base ref.
12+
required: false
13+
default: ${{ github.event.pull_request.base.ref }}
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Setup python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.9"
22+
23+
- name: Install python dependencies
24+
run: |
25+
pip install -U pyyaml
26+
shell: bash
27+
28+
- name: Validate changelog
29+
run: >-
30+
python3 ${{ github.action_path }}/validate_changelog.py
31+
--ref ${{ inputs.base_ref }}
32+
shell: bash
33+
working-directory: ${{ inputs.path }}

scripts/validate_changelog.py renamed to .github/actions/ansible_validate_changelog/validate_changelog.py

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def is_module_or_plugin(ref: str) -> bool:
5454
"plugins/terminal",
5555
"plugins/test",
5656
"plugins/vars",
57+
"roles/",
58+
"playbooks/",
59+
"meta/runtime.yml",
5760
)
5861
return ref.startswith(prefix_list)
5962

.github/workflows/changelog.yml

+2-20
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,12 @@ jobs:
66
runs-on: ubuntu-latest
77
name: Require a changelog
88
if: "!contains(github.event.pull_request.labels.*.name, 'skip-changelog')"
9-
env:
10-
PY_COLORS: "1"
11-
source_directory: "./source"
129
steps:
1310
- name: Checkout the collection repository
1411
uses: actions/checkout@v3
1512
with:
16-
path: ${{ env.source_directory }}
1713
ref: ${{ github.event.pull_request.head.sha }}
1814
fetch-depth: "0"
1915

20-
- name: setup python
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: "3.9"
24-
25-
- name: Download python script
26-
run: curl -o /tmp/validate_changelog.py https://raw.githubusercontent.com/ansible-network/github_actions/main/scripts/validate_changelog.py
27-
28-
- name: Install python required libraries
29-
run: pip install -U pyyaml
30-
31-
- name: Ensure a valid changelog entry exists
32-
run: >-
33-
python /tmp/validate_changelog.py
34-
--ref ${{ github.event.pull_request.base.ref }}
35-
working-directory: ${{ env.source_directory }}
16+
- name: Validate changelog
17+
uses: ansible-network/github_actions/.github/actions/ansible_validate_changelog@main

0 commit comments

Comments
 (0)