forked from wso2/identity-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afb1319
commit de57482
Showing
1 changed file
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -60,13 +60,40 @@ jobs: | |
- name: Extract PR Number Artifact | ||
run: unzip pr-number.zip | ||
|
||
- name: Get Authenticated User Info | ||
- name: 💬 Remove Existing Changeset Comment | ||
uses: actions/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
github-token: ${{ env.GH_TOKEN }} | ||
script: | | ||
const userInfo = await github.users.getAuthenticated(); | ||
console.log("Username:", userInfo.data.login); | ||
const fs = require('fs'); | ||
const PR_NUMBER = Number(fs.readFileSync('./PR_NUMBER', 'utf8').trim()); | ||
const REPO_OWNER = context.repo.owner; | ||
const REPO_NAME = context.repo.repo; | ||
// Fetch all comments on the pull request. | ||
const comments = await github.issues.listComments({ | ||
owner: REPO_OWNER, | ||
repo: REPO_NAME, | ||
issue_number: PR_NUMBER, | ||
}); | ||
console.log("COMMENTS_URL: https://api.github.com/repos/" + REPO_NAME + "/issues/" + PR_NUMBER + "/comments"); | ||
for (const comment of comments.data) { | ||
console.log("COMMENT_OWNER: " + comment.user.login); | ||
// Identify the changeset comment by its heading. | ||
if (comment.body.includes("🦋 Changeset detected") || comment.body.includes("⚠️ No Changeset found")) { | ||
console.log("COMMENT_ID_TO_DELETE: " + comment.id); | ||
// Remove the changeset comment using the comment ID. | ||
await github.issues.deleteComment({ | ||
owner: REPO_OWNER, | ||
repo: REPO_NAME, | ||
comment_id: comment.id, | ||
}); | ||
} | ||
} | ||
- name: 💬 Add Changeset Comment | ||
uses: actions/[email protected] | ||
|