generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NOD-530] feat: Semantic versioning, new GH Action add_patch_label, n…
…ew java version tag
- Loading branch information
1 parent
7021fbb
commit 20676b6
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters