Skip to content
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
13 changes: 6 additions & 7 deletions .github/workflows/jira-android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,18 @@ jobs:
text: '${{ inputs.android-url }}'
path: '${{ inputs.qrcode-filename }}'
- name: Build Comment
run: python ci-scripts/build_android_comment.py > jira_comment.json
run: python ci-scripts/build_android_comment.py > comment.json
env:
CI_AUTHOR_NAME: '${{ github.actor }}'
CI_REPO_URL: '${{ github.server_url }}/${{ github.repository }}'
CI_PROJECT_NAME: '${{ github.event.repository.name }}'
CI_PROJECT_DIR: '${{ github.workspace }}'
CI_JIRA_TICKET_ID: '${{ inputs.jira-ticket-id }}'
CI_TICKET_ID: '${{ inputs.ticket-id }}'
CI_ANDROID_URL: '${{ inputs.android-url }}'
CI_ANDROID_QRCODE: '${{ inputs.qrcode-filename }}'
- name: Post Comment
uses: ./ci-scripts/actions/jira-comment
uses: ./ci-scripts/actions/issue-comment
with:
comment_file: jira_comment.json
user: ${{ secrets.JIRA_USER }}
password: ${{ secrets.JIRA_PASSWORD }}
url: ${{ secrets.JIRA_URL }}
comment_file: comment.json
token: ${{ secrets.YOUTRACK_TOKEN }}
url: ${{ vars.YOUTRACK_URL }}
11 changes: 5 additions & 6 deletions .github/workflows/jira-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
repository: baltech-ag/ci-scripts
path: ci-scripts
- name: Build Comment
run: python ci-scripts/build_pr_comment.py > jira_comment.json
run: python ci-scripts/build_pr_comment.py > comment.json
env:
CI_PR_AUTHOR_NAME: ${{ github.event.pull_request.user.login }}
CI_PR_TITLE: ${{ github.event.pull_request.title }}
Expand All @@ -23,12 +23,11 @@ jobs:
CI_PROJECT_NAME: ${{ github.event.repository.name }}
CI_PROJECT_URL: ${{ github.event.repository.html_url }}
- name: Post Comment
uses: ./ci-scripts/actions/jira-comment
uses: ./ci-scripts/actions/issue-comment
with:
comment_file: jira_comment.json
user: ${{ secrets.JIRA_USER }}
password: ${{ secrets.JIRA_PASSWORD }}
url: ${{ secrets.JIRA_URL }}
comment_file: comment.json
token: ${{ secrets.YOUTRACK_TOKEN }}
url: ${{ vars.YOUTRACK_URL }}
- name: Cleanup
if: always()
run: rm -rf ci-scripts
13 changes: 6 additions & 7 deletions .github/workflows/jira-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ jobs:
echo "CI_COMMIT_BEFORE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV
echo "CI_COMMIT_SHA=" >> $GITHUB_ENV
echo "CI_COMMIT_REF_NAME=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Jira integration
run: python ci-scripts/build_push_comment.py > jira_comment.json
- name: Build comment
run: python ci-scripts/build_push_comment.py > comment.json
env:
CI_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
CI_PROJECT_NAME: ${{ github.event.repository.name }}
CI_PROJECT_DIR: ${{ github.workspace }}
- name: Post Comment
uses: ./ci-scripts/actions/jira-comment
uses: ./ci-scripts/actions/issue-comment
with:
comment_file: jira_comment.json
user: ${{ secrets.JIRA_USER }}
password: ${{ secrets.JIRA_PASSWORD }}
url: ${{ secrets.JIRA_URL }}
comment_file: comment.json
token: ${{ secrets.YOUTRACK_TOKEN }}
url: ${{ vars.YOUTRACK_URL }}
- name: Cleanup
if: always()
run: rm -rf ci-scripts
51 changes: 24 additions & 27 deletions .github/workflows/release-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
--event='${{ github.event_name }}' `
--ref='${{ github.head_ref || github.ref }}' `
--repository-name='${{ github.event.repository.name }}' `
--jira-project='${{ vars.JIRA_PROJECT }}' `
--jira-version-template='${{ vars.JIRA_VERSION_TEMPLATE }}' `
--project='${{ vars.PROJECT }}' `
--version-template='${{ vars.VERSION_TEMPLATE }}' `
| Out-File -FilePath $env:GITHUB_OUTPUT
Get-Content -Path $env:GITHUB_OUTPUT # prints output variables for debugging purposes
- name: Check for latest template version
Expand All @@ -82,28 +82,27 @@ jobs:
version-file: ${{ steps.context.outputs.version-file }}
tag: ${{ steps.context.outputs.tag }}
base-branch: ${{ steps.context.outputs.base-branch }}
jira-project: ${{ steps.context.outputs.jira-project }}
jira-version: ${{ steps.context.outputs.jira-version }}
project: ${{ steps.context.outputs.project }}
issue-version: ${{ steps.context.outputs.issue-version }}

create-pr:
name: Create PR
runs-on: windows-2022
needs: [release-context]
if: needs.release-context.outputs.release-stage == 'branch-created'
steps:
- id: jira-version-exists
uses: baltech-ag/ci-scripts/actions/jira-version-exists@master
- id: version-exists
uses: baltech-ag/ci-scripts/actions/version-exists@master
with:
project: ${{ needs.release-context.outputs.jira-project }}
version: ${{ needs.release-context.outputs.jira-version }}
user: ${{ vars.JIRA_USER }}
password: ${{ secrets.JIRA_PASSWORD }}
url: ${{ vars.JIRA_URL }}
- name: jira version required
if: ${{ steps.jira-version-exists.outputs.exists != '1' }}
project: ${{ needs.release-context.outputs.project }}
version: ${{ needs.release-context.outputs.issue-version }}
token: ${{ secrets.YOUTRACK_TOKEN }}
url: ${{ vars.YOUTRACK_URL }}
- name: version required
if: ${{ steps.version-exists.outputs.exists != '1' }}
run: |
echo "${{ steps.jira-version-exists.output.exists }}"
echo "::error::Jira Version ${{ needs.release-context.outputs.jira-version }} does not exist in project ${{ needs.release-context.outputs.jira-project }}"
echo "${{ steps.version-exists.output.exists }}"
echo "::error::Version ${{ needs.release-context.outputs.issue-version }} does not exist in project ${{ needs.release-context.outputs.project }}"
exit 1
- name: Generate a token
id: generate-token
Expand Down Expand Up @@ -194,13 +193,12 @@ jobs:
run: |
git tag ${{ needs.release-context.outputs.tag }}
git push origin ${{ needs.release-context.outputs.tag }}
- uses: baltech-ag/ci-scripts/actions/jira-release-version@master
- uses: baltech-ag/ci-scripts/actions/release-version@master
with:
project: ${{ needs.release-context.outputs.jira-project }}
version: ${{ needs.release-context.outputs.jira-version }}
user: ${{ vars.JIRA_USER }}
password: ${{ secrets.JIRA_PASSWORD }}
url: ${{ vars.JIRA_URL }}
project: ${{ needs.release-context.outputs.project }}
version: ${{ needs.release-context.outputs.issue-version }}
token: ${{ secrets.YOUTRACK_TOKEN }}
url: ${{ vars.YOUTRACK_URL }}

cherry-picks:
name: Create PRs with cherry-picks for version branches
Expand Down Expand Up @@ -285,7 +283,7 @@ jobs:
PR_BODY: ${{ github.event.pull_request.body }}

closing-issues:
name: Closes JIRA issues mentioned in the PR body
name: Closes issues mentioned in the PR body
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
steps:
Expand All @@ -300,12 +298,11 @@ jobs:
- name: Close Issues
run: |
while IFS= read -r LINE; do
if [[ $LINE =~ ^closes:[[:space:]]*([A-Za-z]+-[0-9]+)[[:space:]]*$ ]]; then
if [[ $LINE =~ ^closes:[[:space:]]*([A-Za-z]+-[0-9]+)[[:space:]]*$ ]]; then
ISSUE=${BASH_REMATCH[1]}
python jira.py \
--base-url="${{ vars.JIRA_URL }}" \
--username="${{ vars.JIRA_USER }}" \
--password="${{ secrets.JIRA_PASSWORD }}" \
python youtrack.py \
--base-url="${{ vars.YOUTRACK_URL }}" \
--token="${{ secrets.YOUTRACK_TOKEN }}" \
close-issue \
--issue=$ISSUE || echo "::error::could not close $ISSUE"
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
name: "Jira Comment"
description: "Adds a Comment to an Jira Issue"
name: "Issue Comment"
description: "Adds a Comment to a YouTrack Issue"
branding:
icon: message-square
color: blue
inputs:
comment_file:
required: true
description: "Path to a json file with the comments (dict with issue as key and comment as value)"
user:
token:
required: true
description: "Jira username"
password:
required: true
description: "Jira user password"
description: "YouTrack API token"
url:
required: true
description: "Jira base url"
description: "YouTrack base url"
runs:
using: composite
steps:
- shell: powershell
if: runner.os == 'Windows'
run: |
python "${{ github.action_path }}/../../jira.py" `
python "${{ github.action_path }}/../../youtrack.py" `
--base-url="${{ inputs.url }}" `
--username="${{ inputs.user }}" `
--password="${{ inputs.password }}" `
--token="${{ inputs.token }}" `
add-comments `
--comments-file="${{ inputs.comment_file }}"
- shell: bash
if: runner.os != 'Windows'
run: |
python "${{ github.action_path }}/../../jira.py" \
python "${{ github.action_path }}/../../youtrack.py" \
--base-url="${{ inputs.url }}" \
--username="${{ inputs.user }}" \
--password="${{ inputs.password }}" \
--token="${{ inputs.token }}" \
add-comments \
--comments-file="${{ inputs.comment_file }}"
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
name: "Jira Issue Exists"
description: "Checks if a Jira Issue exists"
name: "Issue Exists"
description: "Checks if a YouTrack Issue exists"
branding:
icon: check-square
color: blue
inputs:
issue:
required: true
description: "Jira Issue ID (e.g. PROD-80)"
user:
description: "YouTrack Issue ID (e.g. PROD-80)"
token:
required: true
description: "Jira username"
password:
required: true
description: "Jira user password"
description: "YouTrack API token"
url:
required: true
description: "Jira base url"
description: "YouTrack base url"
outputs:
exists:
description: "1 if the Issue exists else 0"
Expand All @@ -26,13 +23,12 @@ runs:
- id: check
shell: bash
run: |
issue=`python "${{ github.action_path }}/../../jira.py" \
issue=`python "${{ github.action_path }}/../../youtrack.py" \
--base-url="${{ inputs.url }}" \
--username="${{ inputs.user }}" \
--password="${{ inputs.password }}" \
--token="${{ inputs.token }}" \
get-issue \
--issue="${{ inputs.issue }}"`

if [[ $issue ]]; then
echo "exists=1" >> $GITHUB_OUTPUT
else
Expand Down
34 changes: 0 additions & 34 deletions actions/jira-release-version/action.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions actions/release-version/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release Version
description: Releases a YouTrack Version
branding:
icon: arrow-up
color: green
inputs:
project:
required: true
description: YouTrack Project Key (e.g. FW)
version:
required: true
description: YouTrack Version Name (e.g. 3.01.03)
token:
required: true
description: YouTrack API token
url:
required: true
description: YouTrack base url
runs:
using: composite
steps:
- id: check
shell: bash
run: |
python "${{ github.action_path }}/../../youtrack.py" \
--base-url="${{ inputs.url }}" \
--token="${{ inputs.token }}" \
release-version \
--project="${{ inputs.project }}" \
--version="${{ inputs.version }}"
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
name: Jira Version Exists
description: Checks if a Jira Version exists
name: Version Exists
description: Checks if a YouTrack Version exists
branding:
icon: check-square
color: blue
inputs:
project:
required: true
description: Jira Project Key (e.g. FW)
description: YouTrack Project Key (e.g. FW)
version:
required: true
description: Jira Version Name (e.g. PROD-80)
user:
description: YouTrack Version Name (e.g. 3.01.03)
token:
required: true
description: Jira username
password:
required: true
description: Jira user password
description: YouTrack API token
url:
required: true
description: Jira base url
description: YouTrack base url
outputs:
exists:
description: 1 if the Issue exists else 0
description: 1 if the Version exists else 0
value: ${{ steps.check.outputs.exists }}
runs:
using: composite
steps:
- id: check
shell: bash
run: |
version=`python "${{ github.action_path }}/../../jira.py" \
version=`python "${{ github.action_path }}/../../youtrack.py" \
--base-url="${{ inputs.url }}" \
--username="${{ inputs.user }}" \
--password="${{ inputs.password }}" \
--token="${{ inputs.token }}" \
get-version \
--project="${{ inputs.project }}" \
--version="${{ inputs.version }}"`

if [[ $version ]]; then
echo "exists=1" >> $GITHUB_OUTPUT
else
Expand Down
Loading