diff --git a/.github/workflows/jira-link-pr.yml-disabled b/.github/workflows/jira-link-pr.yml-disabled new file mode 100644 index 00000000000..b8dfc4d1f18 --- /dev/null +++ b/.github/workflows/jira-link-pr.yml-disabled @@ -0,0 +1,20 @@ +name: Link PR to Jira Ticket +on: + pull_request: + types: [opened, edited, synchronize] + +permissions: + contents: read + pull-requests: read + +jobs: + link-jira: + uses: mohamadjaara/jira-description-action@master + with: + jira-base-url: https://wearezeta.atlassian.net + jira-ticket-regex: '[A-Z]+-[0-9]+' + skip-actors: 'dependabot[bot],AndroidBob' + skip-branches: '^(production-release|main|master|release\/v\d+)$' + repository-owner-check: 'wireapp' + secrets: + jira-token: ${{ secrets.JIRA_TOKEN }} diff --git a/.github/workflows/jira-lint-and-link.yml b/.github/workflows/jira-lint-and-link.yml index 5103c3f4c18..5bd1926cd3d 100644 --- a/.github/workflows/jira-lint-and-link.yml +++ b/.github/workflows/jira-lint-and-link.yml @@ -1,27 +1,34 @@ name: Link and Lint PR with Jira Ticket Number on: - merge_group: pull_request: types: [opened, edited, synchronize] permissions: contents: read pull-requests: write + jobs: - add-jira-description: + get-version: runs-on: ubuntu-latest # Run only if the PR is not from a Fork / external contributor if: ${{ github.repository_owner == 'wireapp' }} + outputs: + version_name: ${{ steps.version.outputs.version_name }} steps: - - name: Check for Dependabot - if: github.actor == 'dependabot[bot]' || github.actor == 'AndroidBob' - run: echo "PR created by Dependabot or AndroidBob, exiting successfully" && exit 0 + - name: Get version name from source + id: version + run: | + VERSION=$(curl -s https://raw.githubusercontent.com/${{ github.repository }}/${{ github.head_ref || github.ref_name }}/build-logic/plugins/src/main/kotlin/AndroidCoordinates.kt | grep 'const val versionName' | sed -E 's/.*"([^"]+)".*/\1/') + echo "version_name=$VERSION" >> $GITHUB_OUTPUT - - uses: cakeinpanic/jira-description-action@v0.9.0 - name: jira-description-action - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - jira-token: ${{ secrets.JIRA_TOKEN }} - jira-base-url: https://wearezeta.atlassian.net - skip-branches: '^(production-release|main|master|release\/v\d+)$' #optional - fail-when-jira-issue-not-found: true + add-jira-description: + needs: get-version + uses: wireapp/.github/.github/workflows/jira-link-pr-reusable.yml@mo/ci/jira-linking-gh-action # TODO: replace with commit hash + with: + skip-branches: '^(production-release|main|master|release\/v\d+)$' + skip-actors: 'dependabot[bot],AndroidBob' + version-name: ${{ needs.get-version.outputs.version_name }} + fix-version-regex: '(?:^|[\s\-_])(v?\d+\.\d+(?:\.\d+)?(?:[\-\+][\w\.\-]*)?)' + secrets: + github-token: ${{ secrets.GITHUB_TOKEN }} + jira-token: ${{ secrets.JIRA_TOKEN }}