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

Wf updates #4

Closed
wants to merge 2 commits into from
Closed
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
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
Loading