Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOD-530] feat: Semantic versioning, new GH Action add_patch_label #16

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]
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/[email protected]
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.'
});
2 changes: 1 addition & 1 deletion .github/workflows/03_code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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@50aaf5cffa09d76b953e64a630bc9e0528a6d73b
uses: pagopa/github-actions-template/maven-code-review@v1.8.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
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 @@ -69,7 +69,7 @@ jobs:
steps:
- name: Semver setup
id: semver_setup
uses: pagopa/github-actions-template/nodo5-semver-setup@de4ca1ddefb1461c176cc42259e494158b578fe3
uses: pagopa/github-actions-template/nodo5-semver-setup@ce252c8501c9242bd6045f7cdd650736b2f38777
with:
semver: ${{ inputs.semver }}

Expand Down
Loading