generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 2.26 KB
/
01_add_patch_label.yml
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
name: Add PATCH default label
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request_target:
branches:
- main
types: [ opened, reopened ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
add_patch_label:
runs-on: ubuntu-latest
name: Add default label
steps:
- name: Check user labels
id: check_user_labels
uses: actions/github-script@v6.3.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var addPatch = "true";
// retrieve label list
let labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
// verify if user have already added IGNORE-FOR-RELEASE, then skip add PATCH
// note: GitHub labels are added in .identity/03_github_environment.tf as github_issue_label resource
if (labels.data.find(label => label.name === 'ignore-for-release')){
addPatch = "false";
}
return addPatch;
result-encoding: string
- name: Add PATCH label
if: ${{ steps.check_user_labels.outputs.result == 'true' }}
uses: pagopa/github-actions-template/default-label@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
label: 'patch'
- name: Add comment
if: ${{ steps.check_user_labels.outputs.result == 'true' }}
uses: actions/github-script@v6.3.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'The default action is to increase the `PATCH` number of `SEMVER`. Set `IGNORE-FOR-RELEASE` if you want to skip `SEMVER` bump. `BREAKING-CHANGE` and `NEW-RELEASE` must be run from GH Actions section manually.'
});