From 843c77083bcd60662d8dc43be57a56016a9566b0 Mon Sep 17 00:00:00 2001 From: Wolf Date: Thu, 21 Dec 2023 19:41:02 +0000 Subject: [PATCH] Cleanup workflows --- .github/workflows/cicd-pipeline.yml | 113 ++++++++------------------ .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/greetings.yml | 2 +- .github/workflows/repo-linting.yml | 2 +- .github/workflows/security.yml | 2 +- 5 files changed, 40 insertions(+), 81 deletions(-) diff --git a/.github/workflows/cicd-pipeline.yml b/.github/workflows/cicd-pipeline.yml index 43da249..16c69d6 100644 --- a/.github/workflows/cicd-pipeline.yml +++ b/.github/workflows/cicd-pipeline.yml @@ -4,111 +4,70 @@ on: push: branches: - '**' - paths-ignore: - - '**.md' pull_request: branches: - '**' - paths-ignore: - - '**.md' workflow_dispatch: + inputs: + slack-notify: + description: 'Notify Slack' + required: true + default: 'true' + type: choice + options: + - 'true' + - 'false' env: SLACK_NOTIFY: true +permissions: read-all + jobs: bandit: name: Bandit - uses: actionstoolbox/reusable-workflows/reusable-workflows/bandit.yml@main + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-bandit.yml@master - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Set up Python 3.11 - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 - with: - python-version: "3.11" - - name: Run Bandit - env: - EXCLUDE_FILES: '\.md$' - run: bash <(curl -s https://github.com/raw/CICDToolbox/bandit/master/pipeline.sh) + pycodestyle: + name: Pycodestyle + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-pycodestyle.yml@master pydocstyle: name: Pydocstyle - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Set up Python 3.11 - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 - with: - python-version: "3.11" - - name: Run Pydocstyle - run: bash <(curl -s https://github.com/raw/CICDToolbox/pydocstyle/master/pipeline.sh) - - pycodestyle: - name: Pycodestyle - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Set up Python 3.11 - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 - with: - python-version: "3.11" - - name: Run Pycodestyle - env: - EXCLUDE_FILES: '\.md$' - run: bash <(curl -s https://github.com/raw/CICDToolbox/pycodestyle/master/pipeline.sh) + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-pydocstyle.yml@master pylama: name: Pylama - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Set up Python 3.11 - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 - with: - python-version: "3.11" - - name: Run Pylama - run: bash <(curl -s https://github.com/raw/CICDToolbox/pylama/master/pipeline.sh) + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-pylama.yml@master pylint: name: Pylint + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-pylint.yml@master + + set-slack-notify: + name: Set Slack Notify runs-on: ubuntu-latest + outputs: + slack-notify: ${{ steps.set-slack-notify.outputs.slack-notify }} steps: - - name: Checkout the repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Set up Python 3.11 - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 - with: - python-version: "3.11" - - name: Run Pylint - env: - EXCLUDE_FILES: '\.md$,setup.py' - run: bash <(curl -s https://github.com/raw/CICDToolbox/pylint/master/pipeline.sh) + - name: Set Slack Notify + id: set-slack-notify + run: | + echo "slack-notify=${{ github.event.inputs.slack-notify || env.SLACK_NOTIFY }}" >> "${GITHUB_OUTPUT}" slack-workflow-status: - if: always() && ${{ github.actor != 'dependabot[bot]' }} + if: always() && github.actor != 'dependabot[bot]' name: Slack Post Workflow Notification needs: - bandit - - pydocstyle - pycodestyle + - pydocstyle - pylama - pylint - runs-on: ubuntu-latest - steps: - - name: Slack Workflow Notifications - if: ${{ env.SLACK_NOTIFY == 'true' && github.event_name == 'push' }} - uses: Gamesight/slack-workflow-status@26a36836c887f260477432e4314ec3490a84f309 # v1.2.0 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} - include_jobs: on-failure - include_commit_message: true -# -# End of Template (part 2) -# + - set-slack-notify + uses: WolfSoftware/reusable-workflows/.github/workflows/reusable-slack.yml@master + with: + slack_notify: ${{ needs.set-slack-notify.outputs.slack-notify }} + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 04db954..93f0fd8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,7 +43,7 @@ jobs: uses: github/codeql-action/analyze@421a1b344fb0def373a0794a4051f19f207461ec # v2.2.1 slack-workflow-status: - if: always() && ${{ github.actor != 'dependabot[bot]' }} + if: always() && github.actor != 'dependabot[bot]' name: Slack Post Workflow Notification needs: - analyze diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 93aa433..71d767e 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -24,7 +24,7 @@ jobs: pr-message: "Thank you for raising your first pull request - all contributions to this project are welcome!" slack-workflow-status: - if: always() && ${{ github.actor != 'dependabot[bot]' }} + if: always() && github.actor != 'dependabot[bot]' name: Slack Post Workflow Notification needs: - greeting diff --git a/.github/workflows/repo-linting.yml b/.github/workflows/repo-linting.yml index b4289c6..44deb06 100644 --- a/.github/workflows/repo-linting.yml +++ b/.github/workflows/repo-linting.yml @@ -136,7 +136,7 @@ jobs: run: bash <(curl -s https://github.com/raw/CICDToolbox/yaml-lint/master/pipeline.sh) slack-workflow-status: - if: always() && ${{ github.actor != 'dependabot[bot]' }} + if: always() && github.actor != 'dependabot[bot]' name: Slack Post Workflow Notification needs: - actionlint diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 09d5b0d..d1a1602 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -19,7 +19,7 @@ jobs: uses: zgosalvez/github-actions-ensure-sha-pinned-actions@f32435541e24cd6a4700a7f52bb2ec59e80603b1 # v2.1.4 slack-workflow-status: - if: always() && ${{ github.actor != 'dependabot[bot]' }} + if: always() && github.actor != 'dependabot[bot]' name: Slack Post Workflow Notification needs: - harden_security