-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (127 loc) · 4.45 KB
/
on-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: on PR
on:
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- edited
- reopened
concurrency:
group: alpha-versioning
permissions:
contents: write
deployments: write
id-token: write
pull-requests: write
repository-projects: write
jobs:
pr-title-linting:
if: ${{ github.event.pull_request.merged == false }}
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: $(${{ github.event.pull_request.commits }} + 1)
- uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
configuration_path: .github/pr-title-checker-config.json
check-feature:
if: ${{ github.event.pull_request.merged == false }}
name: "check-feature"
uses: ./.github/workflows/check_feature.yaml
secrets: inherit
with:
pull_request_commits: ${{ github.event.pull_request.commits }}
pull_request_head_sha: ${{ github.event.pull_request.head.sha }}
pull_request_base_sha: ${{ github.event.pull_request.base.sha }}
tag_feature:
name: "Alpha Tag"
needs: check-feature
if: ${{ github.event.pull_request.merged == false && github.event.pull_request.user.login != 'dependabot[bot]'}}
runs-on: ubuntu-latest
concurrency:
group: tag-feature-group
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Bump Alpha version
id: bump_alpha_version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
WITH_V: true
INITIAL_VERSION: 0.0.0
RELEASE_BRANCHES: master
DEFAULT_BRANCH: master
PRERELEASE_SUFFIX: alpha
PRERELEASE: true
BRANCH_HISTORY: compare
DRY_RUN: false
VERBOSE: true
# Setting the Build Version
- name: Set Alpha version environment
run: |
echo "ALPHA_VERSION=${{ steps.bump_alpha_version.outputs.new_tag }}" >> $GITHUB_ENV
echo "ALPHA version ${{ env.ALPHA_VERSION }}"
# ======================================================================
# TASK TO AUTOMATICALLY APPROVE AND MERGE DEPENDABOT PR
# "dependabot-approve-pr" needs to depend on check-feature
# ======================================================================
# dependabot-approve-pr:
# name: Approve Dependabot PR
# runs-on: ubuntu-latest
# if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
# needs: [check-feature]
# steps:
# - name: Dependabot metadata
# id: metadata
# uses: dependabot/fetch-metadata@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Auto-approve Dependabot PR
# run: gh pr review --approve "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# dependabot-merge-pr:
# name: Merge Dependabot PR
# runs-on: ubuntu-latest
# if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
# needs: [dependabot-approve-pr]
# steps:
# - name: Dependabot metadata
# id: metadata
# uses: dependabot/fetch-metadata@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Auto-merge Dependabot PR
# run: gh pr merge --auto --squash "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
#
# - name: Merge Conflict Notification
# run: |
# while ! (gh pr view "${PR_URL}" --json state | grep -q "MERGED") && \
# (gh pr view "${PR_URL}" --json mergeable | grep -q "UNKNOWN"); do
# echo "Merge status of ${PR_URL} unknown."
# sleep 5s
# done
#
# if gh pr view "${PR_URL}" --json mergeable | grep -q "CONFLICTING"; then
# curl -X POST -H 'Content-type: application/json' \
# --data "{\"text\":\"This Dependabot PR contains conflicts with master and cannot be merged automatically:\n ${PR_URL}\nPlease, review the pull request and resolve the conflicts manually.\"}" \
# ${{secrets.PR_SUPERVISOR_WEBHOOK}}
# fi
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}