-
Notifications
You must be signed in to change notification settings - Fork 245
ci: add automated thank you workflow for merged PRs #6569
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
Open
shivansh-gohem
wants to merge
4
commits into
pipe-cd:master
Choose a base branch
from
shivansh-gohem:feat/automated-thank-you
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f411486
ci: add automated thank you workflow for merged PRs
shivansh-gohem 21f3d53
ci: address review comments and simplify workflow
shivansh-gohem e6eab7d
ci: use MAINTAINERS.json to check for core maintainers in thank you a…
shivansh-gohem c3ef409
ci: use MAINTAINERS.json to check for core maintainers in thank you a…
shivansh-gohem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Contributor Thank You | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: | ||
| - closed | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| thank-you: | ||
| # Only run if the PR was actually merged | ||
| if: github.event.pull_request.merged | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # We must check out the code to read the MAINTAINERS.json file | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Leave a Thank You Comment | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const creator = context.payload.pull_request.user.login; | ||
|
|
||
| // Skip bots to avoid comment loops | ||
| if (creator.endsWith('[bot]')) { | ||
| console.log('Skipping bot account.'); | ||
| return; | ||
| } | ||
|
|
||
| // Read maintainers list from JSON file | ||
| const maintainersData = JSON.parse(fs.readFileSync('MAINTAINERS.json', 'utf8')); | ||
| const maintainers = maintainersData.maintainers.map(m => m.toLowerCase()); | ||
|
|
||
| // Skip core maintainers to avoid spamming the team | ||
| if (maintainers.includes(creator.toLowerCase())) { | ||
| console.log(`Skipping maintainer account: ${creator}`); | ||
| return; | ||
| } | ||
shivansh-gohem marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const message = 'Thank you for contributing to PipeCD! The changes in this pull request will be part of the upcoming release!'; | ||
|
|
||
| // Post the comment to the PR | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.pull_request.number, | ||
| body: message | ||
| }); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "maintainers": [ | ||
| "khanhtc1202", | ||
| "nghialv", | ||
| "ffjlabo", | ||
| "Warashi", | ||
| "t-kikuc", | ||
| "eeshaanSA" | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.