Skip to content

Commit

Permalink
Merge pull request #6 from pagopa/NOD-530-adeguamento-alla-nuova-gest…
Browse files Browse the repository at this point in the history
…ione-semver

[NOD-530] feat: Semantic versioning, new GH Action add_patch_label, n…
  • Loading branch information
andrea-deri authored Oct 12, 2023
2 parents b951cd9 + 19c2e65 commit 38853b9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/01_add_patch_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.'
});
3 changes: 2 additions & 1 deletion .github/workflows/03_code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Code Review
uses: pagopa/github-actions-template/maven-code-review@v1.4.1
uses: pagopa/github-actions-template/maven-code-review@v1.8.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
project_key: ${{env.PROJECT_KEY}}
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/*"
cpd_exclusions: "**/model/**,**/entity/*"
java_version: '17'

# smoke-test:
# name: Smoke Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/04_release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
steps:
- name: Semver setup
id: semver_setup
uses: pagopa/github-actions-template/node-semver-setup@a1b72480e9ac555364be0b7ecdcc8f5ab1c89ad9
uses: pagopa/github-actions-template/nodo5-semver-setup@ce252c8501c9242bd6045f7cdd650736b2f38777
with:
semver: ${{ inputs.semver }}

Expand Down

0 comments on commit 38853b9

Please sign in to comment.