-
Notifications
You must be signed in to change notification settings - Fork 2
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
ci: add workflow to check if versioning pr exists #645
Merged
ahrar-deriv
merged 13 commits into
deriv-com:master
from
sahani-deriv:check-versioning-pr
Jun 28, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3e3522e
ci: add workflow to check if versioning pr exists
sahani-deriv f625a80
chore: fix commit hash
sahani-deriv e32101c
ci: add pr comment feat
sahani-deriv ad9a0a5
ci: minor change
sahani-deriv 74d7881
Merge branch 'master' into check-versioning-pr
ahrar-deriv d2be397
ci: add build fail
sahani-deriv 848dc0e
ci: fix set output
sahani-deriv 4a6c054
ci: add delete comment feat
sahani-deriv 4ee5bde
ci: add delete comment feat
sahani-deriv 667d29f
ci: add delete comment feat
sahani-deriv a8b6977
Merge branch 'master' into check-versioning-pr
sahani-deriv 31b2e4a
ci: replace master with commit hash
sahani-deriv f4b45ae
ci: fix naming
sahani-deriv 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 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,61 @@ | ||
name: versioning_pr_exists | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, reopened, synchronize] | ||
|
||
jobs: | ||
check-version-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@eff380dfbcf941bf8832e4acb788cebe13dfd758 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Check if PR with title chore(version) exists | ||
id: check-pr | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | ||
with: | ||
github-token: ${{ secrets.PAT }} | ||
script: | | ||
const { data: pullRequests } = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open', | ||
per_page: 100 | ||
}); | ||
|
||
const existingPR = pullRequests.find(pr => pr.title === 'chore(version): bump version and update changelog'); | ||
|
||
if (existingPR) { | ||
core.setOutput("VERSIONING_PR_EXISTS", true); | ||
console.log("Version bump pull request exists. Please merge that pr first to pass the check.: #${existingPR.number}"); | ||
} else { | ||
core.setOutput("VERSIONING_PR_EXISTS", false); | ||
console.log("No version bump pull request found."); | ||
} | ||
|
||
- name: Delete comment if exists | ||
uses: izhangzhihao/delete-comment@d075704468e1cf74e60944d9f335351213c34d85 | ||
with: | ||
github_token: ${{ secrets.PAT }} | ||
delete_user_name: mobile-apps-deriv | ||
issue_number: ${{ github.event.number }} | ||
|
||
- name: Comment if versioning PR exists | ||
if: ${{ contains(steps.check-pr.outputs.VERSIONING_PR_EXISTS, 'true') }} | ||
uses: marocchino/sticky-pull-request-comment@4b7290acd5c5b99ef9995db30e52150e705d2475 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
message: | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exit 1 is needed if this is true. and please double check if secrets.PAT has comment access I don't see any comment message on the pr |
||
**Merge Is BLOCKED : we still have a chore(version) pr open, please merge that pr first ** | ||
|
||
- name: Fail if versioning PR exists | ||
if: ${{ contains(steps.check-pr.outputs.VERSIONING_PR_EXISTS, 'true') }} | ||
run: | | ||
echo "A PR with the title 'chore(version)' already exists. Exiting." | ||
exit 1 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is passing even if we have chore available. this is just printing to console log