Skip to content

Commit

Permalink
include workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
zsigmas committed Oct 29, 2024
1 parent 4533546 commit e40bed9
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/hotfix_pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Hotfix checklist

- [ ] Bumped minor version number on both DESCRIPTION and NEWS.md

- [ ] Build passes pipeline checks

- [ ] The new changes do not affect the API

- [ ] The new changes do not affect the documentation (including screenshots)

- [ ] The new changes do not impact the QC report
48 changes: 48 additions & 0 deletions .github/workflows/hotfix_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Create a PR link for hotfix issues
on:
issues:
types: [opened, labeled, edited]

jobs:
create-pr:
if: contains(github.event.issue.labels.*.name, 'hotfix') # This ensures the job only runs if the 'hotfix' label is present
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create PR link and post in comment
id: pr-link-creation
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
run: |
version=$(echo "${{ github.event.issue.title }}" | sed -n 's/.*rc\/\(v[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
# Early return if issue name is not correct
if [ -z "$version" ]; then
gh issue comment ${{ github.event.issue.number }} --body "Version number is not present or incorrect."
exit 1
fi
branch_name="hf/$version"
branch_text="Expected branch name: \`$branch_name\`"
echo "Creating PR link"
title=$(echo ${{ github.event.issue.title }} | jq -sRr @uri)hotfix
pr_url_text="https://github.com/${{github.repository}}/compare/main...${branch_name}?quick_pull=1&template=hotfix_pull_request_template.md&title=${title}&labels=hotfix"
body_url="PR Link: [pull request](<${pr_url_text}>)."
body="$branch_text $body_url"
echo "Creating comment"
gh issue comment ${{ github.event.issue.number }} --body "$body"
12 changes: 6 additions & 6 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
create-pr:
if: contains(github.event.issue.labels.*.name, 'Release') # This ensures the job only runs if the 'Release' label is present
if: contains(github.event.issue.labels.*.name, 'release') # This ensures the job only runs if the 'release' label is present
runs-on: ubuntu-latest
permissions:
issues: write
Expand All @@ -30,14 +30,14 @@ jobs:
branch_name="rc/$version"
branch_text="A new branch named \`$branch_name\` should be created for your PR."
branch_text="Expected branch name: \`$branch_name\`"
echo "Creating PR link"
title=$(echo ${{ github.event.issue.title }} | jq -sRr @uri)
pr_url_text="https://github.com/${{github.repository}}/compare/main...${branch_name}?quick_pull=1&template=pull_request_template.md&title=${title}&labels=release"
body_url="A link to create a pull request into main is available in [pull request](<${pr_url_text}>)."
title=$(echo ${{ github.event.issue.title }} | jq -sRr @uri)hotfix
pr_url_text="https://github.com/${{github.repository}}/compare/main...${branch_name}?quick_pull=1&template=release_pull_request_template.md&title=${title}&labels=hotfix"
body_url="PR Link: [pull request](<${pr_url_text}>)."
body="$branch_text $body_url"
body="$branch_text $body_url"
echo "Creating comment"
gh issue comment ${{ github.event.issue.number }} --body "$body"
Expand Down

0 comments on commit e40bed9

Please sign in to comment.