Skip to content

Commit

Permalink
ci: make dependabot merge depend on passed tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-J-Lawrence committed Sep 24, 2024
1 parent 6d3be98 commit 93c9075
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 183 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/ansible-lint.yml

This file was deleted.

153 changes: 153 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Continuous Integration

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: write
pull-requests: write
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
bot-pyLint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint flake8 ansible==10.2.0
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') --fail-under 5 --fail-on F,E,W,C,R
- name: Checking code styling
run: |
flake8 .
#
Bot-ansible-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "ansible-sdv-pipeline"

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Install Ansible-lint
run: |
python -m pip install --upgrade pip
pip install ansible-lint
- name: Running Ansible-lint
run: ansible-lint ./*
#
Bot-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Installing dependencies
run: npm ci
- name: Linting the commit message
run: npx commitlint -V --from=HEAD~1
- name: Linting the application code
run: npm run lint-bot
- name: Running unit tests
run: npm run unit-test
Docs-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"

steps:
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
cache-dependency-path: "**/package-lock.json"

- name: Installing dependencies
run: npm ci

- name: Linting the docs code
run: npm run lint
working-directory: "docs"

- name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next

- name: Building docs
run: npm run build

- name: Uploading artifacts
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/out
#
Docs-deploy:
if: ${{ github.ref == 'refs/heads/main' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
defaults:
run:
working-directory: "docs"
needs: Docs-build

steps:
- name: Publish to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
#
dependabot-merge:
needs: [bot-pyLint, Bot-ansible-lint, Bot-test, Docs-build]
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cicsdev/cics-security-sdv-samples'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
23 changes: 0 additions & 23 deletions .github/workflows/dependabot-merge.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .github/workflows/docs.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/node.js.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/pylint.yml

This file was deleted.

0 comments on commit 93c9075

Please sign in to comment.