Skip to content

Commit 74fb83a

Browse files
authored
Merge pull request #66 from secure-software-engineering/zombie-mode-test
zombie mode test added
2 parents 9cf0538 + 8001901 commit 74fb83a

File tree

3 files changed

+61
-95
lines changed

3 files changed

+61
-95
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ updates:
1010
schedule:
1111
interval: weekly
1212
time: "04:00"
13+
target-branch: "develop"
1314
open-pull-requests-limit: 10

.github/workflows/version.yml

Lines changed: 14 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,21 @@
1-
name: Version handling
2-
1+
name: Release Process
32
on:
3+
push:
4+
branches: ['release/**', 'release-*']
45
pull_request:
5-
types:
6-
- closed
7-
branches:
8-
- master
6+
types: [closed]
7+
branches: [master]
98

109
jobs:
11-
version-update:
12-
# This version does not run on self-opened PRs
13-
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.user.login != 'github-actions[bot]' }}
14-
runs-on: ubuntu-latest
15-
steps:
16-
- name: Checkout source code
17-
uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
20-
# Sets up Java version
21-
- name: Set up Java
22-
uses: actions/setup-java@v4
23-
with:
24-
distribution: 'adopt'
25-
java-package: jdk
26-
java-version: '8'
27-
# Semantic versioning
28-
- name: Semantic versioning
29-
id: versioning
30-
uses: paulhatch/[email protected]
31-
with:
32-
tag_prefix: ""
33-
# A string which, if present in a git commit, indicates that a change represents a
34-
# major (breaking) change, supports regular expressions wrapped with '/'
35-
major_pattern: "(MAJOR)"
36-
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
37-
minor_pattern: "(MINOR)"
38-
# A string to determine the format of the version output
39-
version_format: "${major}.${minor}.${patch}"
40-
# Check, whether there is an existing branch "version_<version>" or an open PR "version_<version>" -> "master"
41-
# and store the results as environment variables
42-
- name: Check if branch and PR exist
43-
# The second command was copied from https://stackoverflow.com/questions/73812503/github-action-stop-the-action-if-pr-already-exists
44-
run: |
45-
echo VERSION_BRANCH_EXISTS=$(git ls-remote --heads origin refs/heads/version_${{ steps.versioning.outputs.version }} | wc -l) >> $GITHUB_ENV
46-
echo PR_EXISTS=$(gh pr list \
47-
--repo "$GITHUB_REPOSITORY" \
48-
--json baseRefName,headRefName \
49-
--jq '
50-
map(select(.baseRefName == "master" and .headRefName == "version_${{ steps.versioning.outputs.version }}"))
51-
| length
52-
') >> $GITHUB_ENV
53-
env:
54-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
# If the branch "version_<version>" does not exist, create the branch and update the version in all files
56-
- name: Create branch and update PathExpression version
57-
if: ${{ env.VERSION_BRANCH_EXISTS == '0' }}
58-
run: |
59-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
60-
git config --global user.name "github-actions[bot]"
61-
git checkout -b version_${{ steps.versioning.outputs.version }}
62-
mvn build-helper:parse-version versions:set -DnewVersion=\${{ steps.versioning.outputs.version }} versions:commit
63-
git ls-files | grep 'pom.xml$' | xargs git add
64-
git commit --allow-empty -am "Update PathExpression version to ${{ steps.versioning.outputs.version }}"
65-
git push origin version_${{ steps.versioning.outputs.version }}
66-
# If a PR "version_<version>" -> "master" does not exist, create the PR
67-
- name: Open pull request for version update
68-
if: ${{ env.PR_EXISTS == '0' }}
69-
run: |
70-
gh pr create -B master -H version_${{ steps.versioning.outputs.version }} -t "Update PathExpression version to ${{ steps.versioning.outputs.version }}" -b "This PR was created by the version-update workflow. Please make sure to delete the branch after merging, otherwise future workflows might fail."
71-
env:
72-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
74-
version-release:
75-
# This job runs only on merged PRs, which were opened by the version-update job
76-
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.user.login == 'github-actions[bot]' }}
10+
handle-version:
7711
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
7815
steps:
79-
- name: Checkout source code
80-
uses: actions/checkout@v4
81-
with:
82-
fetch-depth: 0
83-
# Semantic versioning
84-
- name: Semantic versioning
85-
id: versioning
86-
uses: paulhatch/[email protected]
16+
- uses: secure-software-engineering/actions/version@develop
8717
with:
88-
tag_prefix: ""
89-
# A string which, if present in a git commit, indicates that a change represents a
90-
# major (breaking) change, supports regular expressions wrapped with '/'
91-
major_pattern: "(MAJOR)"
92-
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
93-
minor_pattern: "(MINOR)"
94-
# A string to determine the format of the version output
95-
version_format: "${major}.${minor}.${patch}"
96-
# Create a tag with the newest version to prepare a release
97-
- name: Create tag for new version
98-
run: |
99-
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
100-
git config --global user.name "${{ github.actor }}"
101-
git tag -a ${{ steps.versioning.outputs.version }} -m "PathExpression version ${{ steps.versioning.outputs.version }}"
102-
git push origin ${{ steps.versioning.outputs.version }}
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
java_version: '11'
20+
java_distribution: 'temurin'
21+
target_branch: 'master'

.github/workflows/zombie-mode.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Zombie Mode
2+
on:
3+
pull_request:
4+
types: [opened]
5+
branches: [develop]
6+
schedule:
7+
- cron: '0 6 * * MON'
8+
workflow_dispatch:
9+
10+
jobs:
11+
auto-approve-dependabot:
12+
if: github.actor == 'dependabot[bot]'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
steps:
17+
- uses: secure-software-engineering/actions/dependabot@develop
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
zombie-release:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
steps:
27+
- uses: secure-software-engineering/actions/zombie-mode/prepare-pr@develop
28+
with:
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
base-branch: 'develop'
31+
auto-merge-days: '3'
32+
version-file: 'pom.xml'
33+
34+
auto-merge-aged:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
pull-requests: write
38+
contents: write
39+
steps:
40+
- uses: secure-software-engineering/actions/zombie-mode/merge-pr@develop
41+
with:
42+
github-token: ${{ secrets.GITHUB_TOKEN }}
43+
age-days: '3'
44+
merge-method: 'squash'
45+
delete-branch: 'true'
46+
zombie-label: 'zombie-mode'

0 commit comments

Comments
 (0)