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

.github/workflows: added in create docs ticket automation #1108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
54 changes: 54 additions & 0 deletions .github/workflows/go-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
jobs:
binaries:
name: Binaries
needs: [ create-docs-ticket ]
# Conditional "needs" blocks are not supported in GH actions.
# The if condition below works around this limitation.
if: ${{ ! failure() && ! cancelled() }}
runs-on: ${{ matrix.runner || 'ubuntu-latest' }}
outputs:
output_linux_amd64: ${{ steps.link.outputs.output_linux_amd64_ }}
Expand Down Expand Up @@ -286,5 +290,55 @@ jobs:
assignees: ryanluu12345, ZhouXing19, Jeremyyang920, noelcrl
reviewers: ryanluu12345, ZhouXing19, Jeremyyang920, noelcrl
draft: false

create-docs-ticket:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract short log, ref, and date
id: extract
run: |
echo "Ref: ${GITHUB_REF_NAME#v}"
echo "tag=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
echo "release_date=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
# We are sorting the tags by semver and getting the second highest because that is
# the latest released version. The highest semver is the one currently being released
# since the tagging happens right before this runs.
latest_tag=$(git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -2 | head -1)
echo "$latest_tag is the latest tag"

# Filters all commits from latest tag to now, looks for release notes, excludes empty ones, and adds a dash at the front of each line.
output=$(git log $latest_tag..HEAD | grep -i "release note:" | grep -vi 'release note: none' | sed 's/^ *Release Note: *//I' | sed 's/^/- /')
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "shortlog<<$EOF" >> $GITHUB_OUTPUT
echo "'$output'" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Log out the git short log
run: |
echo "${{steps.extract.outputs.shortlog}}"
- name: Login to JIRA
# TODO: needs to whitelist this in the actions settings.
uses: atlassian/gajira-login@master
env:
# TODO: need to add these variables to the repository secrets.
JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ vars.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
- name: Create DOC JIRA ticket
id: create
uses: atlassian/gajira-create@v3
with:
project: DOC
issuetype: Docs
summary: Replicator ("${{steps.extract.outputs.release_date}}") release "${{steps.extract.outputs.tag}}"
description: "${{steps.extract.outputs.shortlog}}"
# 10310 is product area - Migrations. 10175 is doc type - release notes. Assignee is Ryan Kuo.
fields: '{"customfield_10310": {"id": "11464"}, "assignee": {"id": "5d815e4401e2cb0c301faf7e"}, "customfield_10175": {"id": "11432"}}'
- name: Log created issue
id: log-issue
run: echo "Issue ${{ vars.JIRA_BASE_URL }}/browse/${{ steps.create.outputs.issue }} was created" >> "$GITHUB_STEP_SUMMARY"


Loading