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

Move issues on PR activity #12690

Merged
merged 1 commit into from
Mar 11, 2025
Merged
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
32 changes: 32 additions & 0 deletions .github/ghprcomment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,35 @@
Commits will be lost, comments on commits will loose their context.
This makes it harder to review.
In the end, all commits will be [squashed](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits) either way before being merged into the `main`` branch.
- jobName: move_issue
message: |
Your pull request needs to link an issue.

To ease organizational workflows, please link this pull-request to the issue with syntax as described in <https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue>:

> <h2 id="linking-a-pull-request-to-an-issue-using-a-keyword">Linking a pull request to an issue using a keyword</h2>
> <p>You can link a pull request to an issue by using a supported keyword
> in the pull request's description or in a commit message. The pull
> request <strong>must be</strong> on the default branch.</p>
> <ul>
> <li>close</li>
> <li>closes</li>
> <li>closed</li>
> <li>fix</li>
> <li>fixes</li>
> <li>fixed</li>
> <li>resolve</li>
> <li>resolves</li>
> <li>resolved</li>
> </ul>
> <p>If you use a keyword to reference a pull request comment in another
> pull request, the pull requests will be linked. Merging the referencing
> pull request also closes the referenced pull request.</p>
> <p>The syntax for closing keywords depends on whether the issue is in the same repository as the pull request.</p>

### Examples

- ✅ `Fixes #xyz` links pull-request to issue. Merging the PR will close the issue.
- ✅ `Fixes https://github.com/JabRef/jabref/issues/xyz` links pull-request to issue. Merging the PR will close the issue.
- ✅ `Fixes https://github.com/Koppor/jabref/issues/xyz` links pull-request to issue. Merging the PR will close the issue.
- ❌ `Fixes [#xyz](https://github.com/JabRef/jabref/issues/xyz)` links pull-request to issue. Merging the PR will **NOT** close the issue.
57 changes: 57 additions & 0 deletions .github/workflows/on-pr-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Mark issue as available

on:
pull_request_target:
types: [ closed ]

jobs:
unassign_issue:
runs-on: ubuntu-latest
if: github.event.action == 'closed' && !github.event.pull_request.merged
permissions:
contents: read
issues: write
steps:
- name: Determine issue number
id: get_issue_number
uses: koppor/ticket-check-action@add-output
with:
token: ${{ secrets.GITHUB_TOKEN }}
ticketLink: 'https://github.com/:owner/:repo/issues/%ticketNumber%'
ticketPrefix: '#'
titleRegex: '^#(?<ticketNumber>\d+)'
branchRegex: '^(?<ticketNumber>\d+)'
bodyRegex: '#(?<ticketNumber>\d+)'
bodyURLRegex: 'http(s?):\/\/(github.com)(\/:owner)(\/:repo)(\/issues)\/(?<ticketNumber>\d+)'
outputOnly: true
- name: Move issue to "Free to take" in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues/@add-issue-parameter
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
target-labels: "📍 Assigned"
target-column: "Free to take"
ignored-columns: ""
default-column: "Free to take"
issue-number: ${{ steps.get_issue_number.outputs.ticketNumber }}
skip-if-not-in-project: true
- name: Move issue to "Free to take" in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues/@add-issue-parameter
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
target-labels: "📍 Assigned"
target-column: "Free to take"
ignored-columns: ""
default-column: "Free to take"
issue-number: ${{ steps.get_issue_number.outputs.ticketNumber }}
skip-if-not-in-project: true
- uses: actions/checkout@v4
- name: Remove assigned status
run : gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --remove-assignee ${{ github.event.pull_request.user.login }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove assigned label
run : gh issue edit ${{ steps.get_issue_number.outputs.ticketNumber }} --remove-label "📍 Assigned"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55 changes: 55 additions & 0 deletions .github/workflows/on-pr-opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Mark issue as in progress

on:
# _target is required
pull_request_target:

jobs:
move_issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Determine issue number
id: get_issue_number
uses: koppor/ticket-check-action@add-output
with:
token: ${{ secrets.GITHUB_TOKEN }}
ticketLink: 'https://github.com/:owner/:repo/issues/%ticketNumber%'
ticketPrefix: '#'
titleRegex: '^#(?<ticketNumber>\d+)'
branchRegex: '^(?<ticketNumber>\d+)'
bodyRegex: '#(?<ticketNumber>\d+)'
bodyURLRegex: 'http(s?):\/\/(github.com)(\/:owner)(\/:repo)(\/issues)\/(?<ticketNumber>\d+)'
outputOnly: true
- name: Move issue to "In Progress" in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues/@add-issue-parameter
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
target-labels: "📍 Assigned"
target-column: "In Progress"
ignored-columns: ""
default-column: "In Progress"
issue-number: ${{ steps.get_issue_number.outputs.ticketNumber }}
skip-if-not-in-project: true
- name: Move issue to "In Progress" in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues/@add-issue-parameter
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/7"
target-labels: "📍 Assigned"
target-column: "In Progress"
ignored-columns: ""
default-column: "In Progress"
issue-number: ${{ steps.get_issue_number.outputs.ticketNumber }}
skip-if-not-in-project: true
upload-pr-number:
runs-on: ubuntu-latest
steps:
- name: Create pr_number.txt
run: echo "${{ github.event.number }}" > pr_number.txt
- uses: actions/upload-artifact@v4
with:
name: pr_number
path: pr_number.txt
2 changes: 1 addition & 1 deletion .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Comment on PR

on:
workflow_run:
workflows: ["Tests"]
workflows: ["Tests", "Mark issue as in progress"]
types:
- completed

Expand Down
Loading