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

feat(.github/actions): add get-issue-url-and-version-number-v1 action #64

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
37 changes: 37 additions & 0 deletions .github/actions/get-issue-url-and-version-number-v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# get-issue-url-and-version-number-v1

This GitHub Action gets the version number and issue url from the release candidate issue.

## Outputs

| Output | Description |
| ---------------- | ----------------------------------------------------------- |
| `version-number` | The version number of the release candidate. |
| `issue-url` | The url of the issue associated with the release candidate. |

## Example usage

```yaml
name: Get version number and issue url and post to Slack

on: push
Zidious marked this conversation as resolved.
Show resolved Hide resolved

jobs:
post-to-slack:
runs-on: ubuntu-latest
steps:
- name: get version number and release-candidate issue URL
- uses: dequelabs/axe-api-team-public/.github/actions/get-issue-url-and-version-number-v1@main
id: get-version-number-and-issue-url

- name: Slack Notification
# https://github.com/rtCamp/action-slack-notify/commit/b24d75fe0e728a4bf9fc42ee217caa686d141ee8
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7
env:
SLACK_CHANNEL: example-channel
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: '${{ github.event.repository.name }} v${{ steps.get-version-number-and-issue-url.outputs.version-number }} QA NEEDED'
SLACK_MESSAGE: '${{ steps.get-version-number-and-issue-url.outputs.issue-url }}'
SLACK_WEBHOOK: ${{ inputs.slack-webhook }}
MSG_MINIMAL: true
```
34 changes: 34 additions & 0 deletions .github/actions/get-issue-url-and-version-number-v1/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: get-issue-url-and-version-number-v1
description: 'A small GitHub Action to get the version number and issue URL for a release candidate'

outputs:
version-number:
description: 'The version number for the release candidate'
value: ${{ steps.get_issue_url_and_version_number.outputs.version-number }}
issue-url:
description: 'The issue URL for the release candidate'
value: ${{ steps.get_issue_url_and_version_number.outputs.issue-url }}

runs:
using: 'composite'
steps:
- name: Get release-candidate issue URL and version number
id: get_issue_url_and_version_number
shell: bash
run: |
issue=$(gh issue list --repo ${{ github.repository }} --label release --state open --json url,title)
echo "Issue: $issue"

issueURL=$(echo $issue | jq -r '.[0].url')
echo "Issue URL: $issueURL"

issueTitle=$(echo $issue | jq -r '.[0].title')
echo "Issue Title: $issueTitle"

# Get the version number from the issue title e.g. 1.33.7
versionNumber=$(echo $issueTitle | grep --only-matching --extended-regexp '[0-9]+.[0-9]+.[0-9]+')
echo "Version Number: $versionNumber"

echo "issue-url=$issueURL" >> $GITHUB_OUTPUT
echo "version-number=$versionNumber" >> $GITHUB_OUTPUT