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

Add comment to PR if there's no linked issue #7228

Merged
merged 10 commits into from
Aug 16, 2024

Conversation

t-will-gillis
Copy link
Member

@t-will-gillis t-will-gillis commented Aug 6, 2024

Fixes #7140

What changes did you make?

  • In pull-request-trigger.yml, replaced existing with code reference to js
  • In github-actions/trigger-pr/ folder created check-linked-issue.js

Why did you make the changes (we will use this info to test)?

  • For both files, this was done to create a workflow to check whether a newly-created PR is correctly linked back to the originating issue.

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

  • No visual changes

Testing logs and test PRs

Notes for testing

This test involves GitHub actions. To review, you will need to have a testing environment set up in your repo. Suggestions:

  • See Updated Notes for HfLA's GitHub Actions
  • For this PR, make sure you have "Issues" enabled. You will need to create an issue so that you have a valid linked issue to reference, then you will need to create test PRs that either do or don't correctly reference the issue. (Don't reference existing HfLA issues or PR numbers while testing)
  • In pull-request-trigger.yml, change line 6 to:
    - '*'
    

Copy link

github-actions bot commented Aug 6, 2024

Want to review this pull request? Take a look at this documentation for a step by step guide!


From your project repository, check out a new branch and test the changes.

git checkout -b t-will-gillis-pr-comment-no-link-7140 gh-pages
git pull https://github.com/t-will-gillis/website.git pr-comment-no-link-7140

@github-actions github-actions bot added role: back end/devOps Tasks for back-end developers Complexity: Medium Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms size: 1pt Can be done in 4-6 hours labels Aug 6, 2024
removing unused module
remove variable and run REST API directly, add reference
@t-will-gillis t-will-gillis changed the title Add comment to PR if there is not a linked issue Add comment to PR if there's no linked issue Aug 7, 2024
Copy link
Member

@daras-cu daras-cu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @t-will-gillis, I tested this in my repo and the workflow seems to be working correctly:

  • When no issue is linked in a PR, the appropriate comment is posted
  • When an invalid issue number is linked, the appropriate comment is posted
  • Otherwise if a valid issue is linked, no comment is posted
  • Action is triggered when opening new PR or editing existing PR

Additionally you edited/added the files as called for in the original issue and your PR is set up correctly. Great job!

Copy link
Member

@jphamtv jphamtv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @t-will-gillis excellent work on this PR.

I tested the workflow on my repo and it works as intended without any issues.
When no issue number or an invalid issue number is provided, relevant comments appear. And when a valid issue number is provided, no comments.

@jphamtv jphamtv merged commit 3867c16 into hackforla:gh-pages Aug 16, 2024
5 checks passed
@t-will-gillis t-will-gillis deleted the pr-comment-no-link-7140 branch August 16, 2024 01:20
del9ra pushed a commit to del9ra/website that referenced this pull request Aug 16, 2024
* Update pull-request-trigger.yml

* Create check-linked-issue.js

* Update pull-request-trigger.yml

* Update pull-request-trigger.yml

* Update check-linked-issue.js

* Update check-linked-issue.js

* Update pull-request-trigger.yml

reset branch

* Update check-linked-issue.js

* Update check-linked-issue.js

removing unused module

* Update check-linked-issue.js

remove variable and run REST API directly, add reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Medium Feature: Refactor GHA Refactoring GitHub actions to fit latest architectural norms role: back end/devOps Tasks for back-end developers size: 1pt Can be done in 4-6 hours
Projects
Development

Successfully merging this pull request may close these issues.

Create workflow to comment on PR if dev doesn't link issue
3 participants