Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
ci(GITHUB): workflow standardization
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Feb 25, 2023
1 parent 745aeca commit 47175af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .cookiecutter/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_template": "https://github.com/Shared-Vision-Solutions/ansible-workbench.git",
"_template": "https://github.com/niall-byrne/ansible-workbench.git",
"author": "Niall Byrne",
"company": "Shared Vision Solutions",
"description": "Ansible role that fetches remote content and places it in a configurable location.",
Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ set -eo pipefail
main() {

echo "{}" > package.json
TAG="$(git tag | tr -d "v" | sort --version-sort | tail -n 2 | head -n 1)"
git tag | grep "^${TAG}\$" || TAG="v${TAG}"

TAG="$(git tag -l --sort=refname | grep -E "[0-9]+\.[0-9]+\.[0-9]+" | tail -n 2 | head -n 1)"
CHANGE_LOG_CONTENT="$(npx -q generate-changelog -f - -t "${TAG}")"

{
echo "CHANGE_LOG_CONTENT<<EOF"
echo "${CHANGE_LOG_CONTENT}"
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
set -eo pipefail

main() {

BRANCH_OR_TAG="$(echo "${GITHUB_REF}" | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')"
WORKFLOW_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"

Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
set -eo pipefail

main() {

if [[ "$(poetry version -s)" != "${BRANCH_OR_TAG}" ]]; then
echo "The 'pyproject.toml' file does not match the version tag!"
exit 127
fi

}

main "$@"
16 changes: 8 additions & 8 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: error reporting job status!"
create_release:
needs: [_start_notification, documentation_test, molecule_lint, osx_build, security_test, toml_lint, workflow_lint]
needs: [_start_notification, documentation_test, molecule_lint, osx_build, security_test, toml_lint, yaml_lint]

runs-on: ubuntu-latest

Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Documentation Test -- Documentation Validation
uses: gaurav-nelson/github-action-markdown-link-check@1.0.13
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'no'
use-verbose-mode: 'yes'
Expand Down Expand Up @@ -392,33 +392,33 @@ jobs:
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: toml linting has failed!"
workflow_lint:
yaml_lint:

runs-on: ubuntu-latest

steps:
- name: Workflow Lint -- Checkout Repository
- name: Yaml Lint -- Checkout Repository
uses: actions/checkout@v3

- name: Workflow Lint -- Setup Environment
- name: Yaml Lint -- Setup Environment
run: |
source ./.github/scripts/setup.sh
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

- name: Workflow Lint -- Run Linter
- name: Yaml Lint -- Run Linter
uses: ibiqlik/action-yamllint@v3
with:
format: standard
file_or_dir: ./.github/workflows
config_file: ./.yamllint

- name: Workflow Lint -- Report Job Status (Success)
- name: Yaml Lint -- Report Job Status (Success)
if: env.VERBOSE_NOTIFICATIONS == '1'
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":white_check_mark: workflow linting was successful!"
- name: Workflow Lint -- Report Job Status (Failure)
- name: Yaml Lint -- Report Job Status (Failure)
if: failure()
run: |
./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: workflow linting has failed!"

0 comments on commit 47175af

Please sign in to comment.