Skip to content

Commit 82ed033

Browse files
ci: make dependabot merge depend on passed tasks
1 parent 6d3be98 commit 82ed033

7 files changed

Lines changed: 154 additions & 188 deletions

File tree

.github/workflows/ansible-lint.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
Bot-pyLint:
21+
runs-on: ubuntu-latest
22+
defaults:
23+
run:
24+
working-directory: "ansible-sdv-pipeline"
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python 3.x
29+
uses: actions/setup-python@v3
30+
with:
31+
python-version: 3.x
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install pylint flake8 ansible==10.2.0
36+
pip install -r requirements.txt
37+
- name: Analysing the code with pylint
38+
run: |
39+
pylint $(git ls-files '*.py') --fail-under 5 --fail-on F,E,W,C,R
40+
- name: Checking code styling
41+
run: |
42+
flake8 .
43+
#
44+
Bot-ansible-lint:
45+
runs-on: ubuntu-latest
46+
defaults:
47+
run:
48+
working-directory: "ansible-sdv-pipeline"
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
- name: Set up Python 3.x
53+
uses: actions/setup-python@v3
54+
with:
55+
python-version: 3.x
56+
- name: Install Ansible-lint
57+
run: |
58+
python -m pip install --upgrade pip
59+
pip install ansible-lint
60+
- name: Running Ansible-lint
61+
run: ansible-lint ./*
62+
#
63+
Bot-test:
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
- name: Use Node.js 18.x
71+
uses: actions/setup-node@v3
72+
with:
73+
node-version: "18.x"
74+
cache: "npm"
75+
cache-dependency-path: "**/package-lock.json"
76+
- name: Installing dependencies
77+
run: npm ci
78+
- name: Linting the commit message
79+
run: npx commitlint -V --from=HEAD~1
80+
- name: Linting the application code
81+
run: npm run lint-bot
82+
- name: Running unit tests
83+
run: npm run unit-test
84+
Docs-build:
85+
runs-on: ubuntu-latest
86+
defaults:
87+
run:
88+
working-directory: "docs"
89+
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- name: Use Node.js 18.x
94+
uses: actions/setup-node@v3
95+
with:
96+
node-version: "18.x"
97+
cache: "npm"
98+
cache-dependency-path: "**/package-lock.json"
99+
100+
- name: Installing dependencies
101+
run: npm ci
102+
103+
- name: Linting the docs code
104+
run: npm run lint
105+
working-directory: "docs"
106+
107+
- name: Setup Pages
108+
uses: actions/configure-pages@v4
109+
with:
110+
static_site_generator: next
111+
112+
- name: Building docs
113+
run: npm run build
114+
115+
- name: Uploading artifacts
116+
if: ${{ github.ref == 'refs/heads/main' }}
117+
uses: actions/upload-pages-artifact@v3
118+
with:
119+
path: ./docs/out
120+
#
121+
Docs-deploy:
122+
if: ${{ github.ref == 'refs/heads/main' }}
123+
environment:
124+
name: github-pages
125+
url: ${{ steps.deployment.outputs.page_url }}
126+
127+
runs-on: ubuntu-latest
128+
defaults:
129+
run:
130+
working-directory: "docs"
131+
needs: Docs-build
132+
133+
steps:
134+
- name: Publish to GitHub Pages
135+
id: deployment
136+
uses: actions/deploy-pages@v4
137+
#
138+
Dependabot-merge:
139+
needs: [bot-pyLint, Bot-ansible-lint, Bot-test, Docs-build]
140+
runs-on: ubuntu-latest
141+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'cicsdev/cics-security-sdv-samples'
142+
steps:
143+
- name: Dependabot metadata
144+
id: metadata
145+
uses: dependabot/fetch-metadata@v2
146+
with:
147+
github-token: "${{ secrets.GITHUB_TOKEN }}"
148+
- name: Enable auto-merge for Dependabot PRs
149+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
150+
run: gh pr merge --auto --merge "$PR_URL"
151+
env:
152+
PR_URL: ${{github.event.pull_request.html_url}}
153+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/dependabot-merge.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/pylint.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# cics-security-sdv-samples
22

3-
[![SDV Approval Bot Build](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/node.js.yml/badge.svg)](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/node.js.yml)
4-
[![SDV Documentation](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/docs.yml/badge.svg)](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/docs.yml)
5-
[![Ansible Lint](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/ansible-lint.yml)
6-
[![Python Lint](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/pylint.yml/badge.svg)](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/pylint.yml)
7-
3+
[![CI/CD Pipeline](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/cicsdev/cics-security-sdv-samples/actions/workflows/continuous-integration.yml)
84

95
This sample repository provides example tooling that contributes towards achieving **[Security definition validation for CICS TS (SDV)](https://www.ibm.com/docs/en/cics-ts/6.x?topic=hiwztic-how-it-works-capturing-validating-security-definitions-during-development-process#hiw-devsecops__title__7)** in a CI/CD pipeline.
106

0 commit comments

Comments
 (0)