Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbazhenoff committed Apr 3, 2024
1 parent 417571a commit 97d5064
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 194 deletions.
152 changes: 76 additions & 76 deletions .github/workflows/ansible_sanity_testing.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
---
# see https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
name: Sanity Testing
on: # yamllint disable-line rule:truthy
push: null
pull_request:
branches:
- main
- master
permissions: read-all

concurrency:
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:

###
# Sanity tests (REQUIRED)
## see https://github.com/ansible-collections/collection_template/blob/main/.github/workflows/ansible-test.yml
#name: Sanity Testing
#on: # yamllint disable-line rule:truthy
# push: null
# pull_request:
# branches:
# - main
# - master
#permissions: read-all
#
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
sanity:
name: Sanity (Ⓐ${{ matrix.ansible }})
permissions:
statuses: write
strategy:
matrix:
ansible:
# It's important that Sanity is tested against all stable-X.Y branches
# Testing against `devel` may fail as new tests are added.
# An alternative to `devel` is the `milestone` branch with
# gets synchronized with `devel` every few weeks and therefore
# tends to be a more stable target. Be aware that it is not updated
# around creation of a new stable branch, this might cause a problem
# that two different versions of ansible-test use the same sanity test
# ignore.txt file.
# Add new versions announced in
# https://github.com/ansible-collections/news-for-maintainers in a timely manner,
# consider dropping testing against EOL versions and versions you don't support.
- stable-2.10
- stable-2.11
- stable-2.12
- stable-2.13
- stable-2.14
- stable-2.15
- stable-2.16
- devel
# - milestone
# Ansible-test on various stable branches does not yet work well with cgroups v2.
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# image for these stable branches. The list of branches where this is necessary will
# shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
# for the latest list.
runs-on: >-
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11"]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
steps:
# Run sanity tests inside a Docker container.
# The docker container has all the pinned dependencies that are
# required and all Python versions Ansible supports.
- name: Perform sanity testing
# See the documentation for the following GitHub action on
# https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
testing-type: sanity
# OPTIONAL If your sanity tests require code
# from other collections, install them like this
# test-deps: >-
# ansible.netcommon
# ansible.utils
# OPTIONAL If set to true, will test only against changed files,
# which should improve CI performance. See limitations on
# https://github.com/ansible-community/ansible-test-gh-action#pull-request-change-detection
pull-request-change-detection: false
#concurrency:
# group: >-
# ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
# cancel-in-progress: true
#
#jobs:
#
####
## Sanity tests (REQUIRED)
##
## https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
# sanity:
# name: Sanity (Ⓐ${{ matrix.ansible }})
# permissions:
# statuses: write
# strategy:
# matrix:
# ansible:
# # It's important that Sanity is tested against all stable-X.Y branches
# # Testing against `devel` may fail as new tests are added.
# # An alternative to `devel` is the `milestone` branch with
# # gets synchronized with `devel` every few weeks and therefore
# # tends to be a more stable target. Be aware that it is not updated
# # around creation of a new stable branch, this might cause a problem
# # that two different versions of ansible-test use the same sanity test
# # ignore.txt file.
# # Add new versions announced in
# # https://github.com/ansible-collections/news-for-maintainers in a timely manner,
# # consider dropping testing against EOL versions and versions you don't support.
# - stable-2.10
# - stable-2.11
# - stable-2.12
# - stable-2.13
# - stable-2.14
# - stable-2.15
# - stable-2.16
# - devel
# # - milestone
# # Ansible-test on various stable branches does not yet work well with cgroups v2.
# # Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
# # image for these stable branches. The list of branches where this is necessary will
# # shrink over time, check out https://github.com/ansible-collections/news-for-maintainers/issues/28
# # for the latest list.
# runs-on: >-
# ${{ contains(fromJson(
# '["stable-2.9", "stable-2.10", "stable-2.11"]'
# ), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
# steps:
# # Run sanity tests inside a Docker container.
# # The docker container has all the pinned dependencies that are
# # required and all Python versions Ansible supports.
# - name: Perform sanity testing
# # See the documentation for the following GitHub action on
# # https://github.com/ansible-community/ansible-test-gh-action/blob/main/README.md
# uses: ansible-community/ansible-test-gh-action@release/v1
# with:
# ansible-core-version: ${{ matrix.ansible }}
# testing-type: sanity
# # OPTIONAL If your sanity tests require code
# # from other collections, install them like this
# # test-deps: >-
# # ansible.netcommon
# # ansible.utils
# # OPTIONAL If set to true, will test only against changed files,
# # which should improve CI performance. See limitations on
# # https://github.com/ansible-community/ansible-test-gh-action#pull-request-change-detection
# pull-request-change-detection: false
236 changes: 118 additions & 118 deletions .github/workflows/mega_linter.yml
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
---
name: MegaLinter
on: # yamllint disable-line rule:truthy
push: null
pull_request:
branches:
- main
- master
permissions: read-all

env:
APPLY_FIXES: all
APPLY_FIXES_EVENT: all
APPLY_FIXES_MODE: pull_request

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
statuses: write

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: MegaLinter
# kics-scan ignore-line
uses: oxsecurity/megalinter@latest
id: ml
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Archive production artifacts
# kics-scan ignore-line
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
# Set APPLY_FIXES_IF var for use in future steps
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"
# Set APPLY_FIXES_IF_* vars for use in future steps
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
}}" >> "${GITHUB_ENV}"
# Create pull request if applicable
# (for now works only on PR from the same repository, not from forks)
- name: Create Pull Request with applied fixes
# kics-scan ignore-line
uses: peter-evans/create-pull-request@v6
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot

- name: Create PR output
if: env.APPLY_FIXES_IF_PR == 'true'
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
# Push new commit if applicable
# (for now works only on PR from the same repository, not from forks)
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
run: sudo chown -Rc $UID .git/

- name: Commit and push applied linter fixes
# kics-scan ignore-line
uses: stefanzweifel/git-auto-commit-action@latest
if: env.APPLY_FIXES_IF_COMMIT == 'true'
with:
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
#name: MegaLinter
#on: # yamllint disable-line rule:truthy
# push: null
# pull_request:
# branches:
# - main
# - master
#permissions: read-all
#
#env:
# APPLY_FIXES: all
# APPLY_FIXES_EVENT: all
# APPLY_FIXES_MODE: pull_request
#
#concurrency:
# group: ${{ github.ref }}-${{ github.workflow }}
# cancel-in-progress: true
#
#jobs:
# megalinter:
# name: MegaLinter
# runs-on: ubuntu-latest
# permissions:
# contents: write
# issues: write
# pull-requests: write
# statuses: write
#
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# with:
# token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
# fetch-depth: 0
#
# - name: MegaLinter
## kics-scan ignore-line
# uses: oxsecurity/megalinter@latest
# id: ml
# env:
# VALIDATE_ALL_CODEBASE: true
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Archive production artifacts
## kics-scan ignore-line
# uses: actions/upload-artifact@v4
# if: success() || failure()
# with:
# name: MegaLinter reports
# path: |
# megalinter-reports
# mega-linter.log
#
# # Set APPLY_FIXES_IF var for use in future steps
# - name: Set APPLY_FIXES_IF var
# run: |
# printf 'APPLY_FIXES_IF=%s\n' "${{
# steps.ml.outputs.has_updated_sources == 1 &&
# (
# env.APPLY_FIXES_EVENT == 'all' ||
# env.APPLY_FIXES_EVENT == github.event_name
# ) &&
# (
# github.event_name == 'push' ||
# github.event.pull_request.head.repo.full_name == github.repository
# )
# }}" >> "${GITHUB_ENV}"
#
# # Set APPLY_FIXES_IF_* vars for use in future steps
# - name: Set APPLY_FIXES_IF_* vars
# run: |
# printf 'APPLY_FIXES_IF_PR=%s\n' "${{
# env.APPLY_FIXES_IF == 'true' &&
# env.APPLY_FIXES_MODE == 'pull_request'
# }}" >> "${GITHUB_ENV}"
# printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
# env.APPLY_FIXES_IF == 'true' &&
# env.APPLY_FIXES_MODE == 'commit' &&
# (!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
# }}" >> "${GITHUB_ENV}"
#
# # Create pull request if applicable
# # (for now works only on PR from the same repository, not from forks)
# - name: Create Pull Request with applied fixes
## kics-scan ignore-line
# uses: peter-evans/create-pull-request@v6
# id: cpr
# if: env.APPLY_FIXES_IF_PR == 'true'
# with:
# token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
# commit-message: "[MegaLinter] Apply linters automatic fixes"
# title: "[MegaLinter] Apply linters automatic fixes"
# labels: bot
#
# - name: Create PR output
# if: env.APPLY_FIXES_IF_PR == 'true'
# run: |
# echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
# echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
#
# # Push new commit if applicable
# # (for now works only on PR from the same repository, not from forks)
# - name: Prepare commit
# if: env.APPLY_FIXES_IF_COMMIT == 'true'
# run: sudo chown -Rc $UID .git/
#
# - name: Commit and push applied linter fixes
## kics-scan ignore-line
# uses: stefanzweifel/git-auto-commit-action@latest
# if: env.APPLY_FIXES_IF_COMMIT == 'true'
# with:
# branch: >-
# ${{
# github.event.pull_request.head.ref ||
# github.head_ref ||
# github.ref
# }}
# commit_message: "[MegaLinter] Apply linters fixes"

0 comments on commit 97d5064

Please sign in to comment.