diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 34e7965..9e7e2eb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,6 +22,7 @@ jobs: cache: 'pip' # caching pip dependencies - name: Restore Ansible cache + id: cache-ansible uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0 with: path: ~/.ansible/collections @@ -37,6 +38,26 @@ jobs: python3 -m pip install -r requirements.txt echo "::endgroup::" + - name: Install Ansible collections with retries + if: steps.cache-ansible.outputs.cache-hit != 'true' + run: | + set -Eeuo pipefail + for attempt in 1 2 3 4 5; do + if ansible-galaxy collection install -r collections/requirements.yml; then + exit 0 + fi + echo "Ansible Galaxy attempt ${attempt} failed; retrying." + sleep $((attempt * 10)) + done + exit 1 + + - name: Save Ansible collection cache + if: steps.cache-ansible.outputs.cache-hit != 'true' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0 + with: + path: ~/.ansible/collections + key: ansible-${{ hashFiles('collections/requirements.yml') }} + - name: Run pre-commit uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # 3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9d9060..f508715 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,7 @@ repos: - id: ansible-lint additional_dependencies: [ansible-core==2.18.0] language_version: python3.12 + args: [--offline] - repo: https://github.com/shellcheck-py/shellcheck-py rev: v0.9.0.6 hooks: