-
-
Notifications
You must be signed in to change notification settings - Fork 288
[CI] Add changelog bot workflow #1272
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
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
14ab619
[tests:fix] Addressed Selenium unsaved changes test #902
Mahathi-s154 733f0c9
[chores:tests] Fixed mocking in test_update_vpn_server_configuration
nemesifier 9c1d46d
[ci] Added automated backport workflow
atif09 fa2ce3d
[fix] Use context variables in Vpn.auto_client for OpenVPN backend
pandafy 6fe7d90
[ci] Updated CI branches: added 1.2, removed gsoc25 branches
nemesifier 7946420
[docs] Updated organization limits screenshot #1073
UltraBot05 7da8e3f
[chores] CI: added "fail-on-error: false" to coveralls
nemesifier c747ecd
[chores] CI: added "fail-on-error: false" to coveralls (right place)
nemesifier f12ae70
[chores:fix] Add TestMigrationGraphIntegrity to render all project_st…
asmodehn 9b4223d
[feature] Base logic for WHOIS lookup feature #1032 #1033 #1037 #1045
DragnEmperor 2174fcb
[feature] Added WHOIS details to the UI #1026
DragnEmperor 66e14ae
[feature] Allow estimating geographic location based on WHOIS data #1034
DragnEmperor 279e7a2
[feature] Updating stale WHOIS records #1058
DragnEmperor 84cd305
[chores] Improved WHOIS & Estimated Location features
nemesifier 6ab2ca2
[docs] Port changelog for 1.2.1
nemesifier 6623550
[ci] Enabled CI failure bot
stktyagi 9eff757
[change:ux] Improved help text of configuration variable fields
nemesifier 1ebf7b6
[docs] Port changelog for 1.2.2
nemesifier 9e98d3e
[deps] Update responses requirement from ~=0.25.8 to ~=0.26.0
dependabot[bot] 1da4d8e
[deps] Update pytest-timeout requirement from ~=2.3.0 to ~=2.4.0
dependabot[bot] 0e2d8f7
[fix] Fixed mentioning by CI faillure bot
stktyagi 0b897dd
[CI] Add changelog bot workflow
pushpitkamboj 8f82d64
Merge branch 'master' into ci/changelog-bot
pushpitkamboj 11679f5
[change] Add PR approved checks
pushpitkamboj 2b416b5
[ci] Remove old workflow with new trigger and runner yml files
pushpitkamboj e33a1e0
[fix] QA checks
pushpitkamboj 18e754d
[fix] Remove js env, changed permissions for changelog-bot
pushpitkamboj 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,43 @@ | ||
| name: Backport fixes to stable branch | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - main | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| concurrency: | ||
| group: backport-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| backport-on-push: | ||
| if: github.event_name == 'push' | ||
| uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master | ||
| with: | ||
| commit_sha: ${{ github.sha }} | ||
| secrets: | ||
| app_id: ${{ secrets.OPENWISP_BOT_APP_ID }} | ||
| private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} | ||
|
|
||
| backport-on-comment: | ||
| if: > | ||
| github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request && | ||
| github.event.issue.pull_request.merged_at != null && | ||
| github.event.issue.state == 'closed' && | ||
| contains(fromJSON('["MEMBER", "OWNER"]'), github.event.comment.author_association) && | ||
| startsWith(github.event.comment.body, '/backport') | ||
| uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master | ||
| with: | ||
| pr_number: ${{ github.event.issue.number }} | ||
| comment_body: ${{ github.event.comment.body }} | ||
| secrets: | ||
| app_id: ${{ secrets.OPENWISP_BOT_APP_ID }} | ||
| private_key: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} |
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: Changelog Bot Runner | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["Changelog Bot Trigger"] | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: | ||
| actions: read | ||
|
|
||
| jobs: | ||
| fetch-metadata: | ||
| runs-on: ubuntu-latest | ||
| if: github.event.workflow_run.conclusion == 'success' | ||
| permissions: | ||
| actions: read | ||
| outputs: | ||
| pr_number: ${{ steps.metadata.outputs.pr_number }} | ||
| steps: | ||
| - name: Download PR metadata | ||
| id: download | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: changelog-metadata | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| continue-on-error: true | ||
|
|
||
| - name: Read PR metadata | ||
| if: steps.download.outcome == 'success' | ||
| id: metadata | ||
| run: | | ||
| PR_NUMBER=$(cat pr_number) | ||
| if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then | ||
| echo "::error::Invalid PR number: $PR_NUMBER" | ||
| exit 1 | ||
| fi | ||
| echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | ||
| changelog: | ||
| needs: fetch-metadata | ||
| if: needs.fetch-metadata.outputs.pr_number != '' | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-changelog.yml@master | ||
| with: | ||
| pr_number: ${{ needs.fetch-metadata.outputs.pr_number }} | ||
| secrets: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }} | ||
| OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} |
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,38 @@ | ||||||
| name: Changelog Bot Trigger | ||||||
|
|
||||||
| on: | ||||||
| pull_request_review: | ||||||
| types: [submitted] | ||||||
|
|
||||||
| permissions: {} | ||||||
|
|
||||||
| jobs: | ||||||
| check: | ||||||
| if: | | ||||||
| github.event.review.state == 'approved' && | ||||||
| (github.event.review.author_association == 'OWNER' || | ||||||
| github.event.review.author_association == 'MEMBER' || | ||||||
| github.event.review.author_association == 'COLLABORATOR') | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Check for noteworthy PR | ||||||
| id: check | ||||||
| env: | ||||||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||||||
| run: | | ||||||
| if echo "$PR_TITLE" | grep -qiE '^\[(feature|fix|change)\]'; then | ||||||
|
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. CRITICAL: Script injection vulnerability The PR title is passed directly to a shell command without sanitization. A malicious PR title containing shell metacharacters could execute arbitrary code. Consider using bash's regex matching instead of echo + grep:
Suggested change
|
||||||
| echo "has_noteworthy=true" >> $GITHUB_OUTPUT | ||||||
| fi | ||||||
|
|
||||||
| - name: Save PR metadata | ||||||
| if: steps.check.outputs.has_noteworthy == 'true' | ||||||
| env: | ||||||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||||||
| run: echo "$PR_NUMBER" > pr_number | ||||||
|
|
||||||
| - name: Upload PR metadata | ||||||
| if: steps.check.outputs.has_noteworthy == 'true' | ||||||
| uses: actions/upload-artifact@v7 | ||||||
| with: | ||||||
| name: changelog-metadata | ||||||
| path: pr_number | ||||||
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,84 @@ | ||
| name: CI Failure Bot | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: ["OpenWISP Controller CI Build"] | ||
| types: | ||
| - completed | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| actions: read | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ci-failure-${{ github.repository }}-${{ github.event.workflow_run.pull_requests[0].number || github.event.workflow_run.head_branch }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| find-pr: | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
| outputs: | ||
| pr_number: ${{ steps.pr.outputs.number }} | ||
| pr_author: ${{ steps.pr.outputs.author }} | ||
| steps: | ||
| - name: Find PR Number | ||
| id: pr | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| REPO: ${{ github.repository }} | ||
| PR_NUMBER_PAYLOAD: ${{ github.event.workflow_run.pull_requests[0].number }} | ||
| EVENT_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | ||
| run: | | ||
| emit_pr() { | ||
| local pr_number="$1" | ||
| local pr_author | ||
| pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "") | ||
| if [ -z "$pr_author" ]; then | ||
| pr_author="${{ github.event.workflow_run.actor.login }}" | ||
| echo "::warning::Could not fetch PR author for PR #$pr_number; falling back to @$pr_author" | ||
| fi | ||
| echo "number=$pr_number" >> "$GITHUB_OUTPUT" | ||
| echo "author=$pr_author" >> "$GITHUB_OUTPUT" | ||
| } | ||
| PR_NUMBER="$PR_NUMBER_PAYLOAD" | ||
| if [ -n "$PR_NUMBER" ]; then | ||
| echo "Found PR #$PR_NUMBER from workflow payload." | ||
| emit_pr "$PR_NUMBER" | ||
| exit 0 | ||
| fi | ||
| HEAD_SHA="$EVENT_HEAD_SHA" | ||
| echo "Payload empty. Searching for PR via Commits API..." | ||
| PR_NUMBER=$(gh api repos/$REPO/commits/$HEAD_SHA/pulls -q '.[0].number' 2>/dev/null || true) | ||
| if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then | ||
| echo "Found PR #$PR_NUMBER using Commits API." | ||
| emit_pr "$PR_NUMBER" | ||
| exit 0 | ||
| fi | ||
| echo "API lookup failed/empty. Scanning open PRs for matching head SHA..." | ||
| PR_NUMBER=$(gh pr list --repo "$REPO" --state open --limit 100 --json number,headRefOid --jq ".[] | select(.headRefOid == \"$HEAD_SHA\") | .number" | head -n 1) | ||
| if [ -n "$PR_NUMBER" ]; then | ||
| echo "Found PR #$PR_NUMBER by scanning open PRs." | ||
| emit_pr "$PR_NUMBER" | ||
| exit 0 | ||
| fi | ||
| echo "::warning::No open PR found. This workflow run might not be attached to an open PR." | ||
| exit 0 | ||
|
|
||
| call-ci-failure-bot: | ||
| needs: find-pr | ||
| if: ${{ needs.find-pr.outputs.pr_number != '' }} | ||
| uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-ci-failure.yml@master | ||
| with: | ||
| pr_number: ${{ needs.find-pr.outputs.pr_number }} | ||
| head_sha: ${{ github.event.workflow_run.head_sha }} | ||
| head_repo: ${{ github.event.workflow_run.head_repository.full_name }} | ||
| base_repo: ${{ github.repository }} | ||
| run_id: ${{ github.event.workflow_run.id }} | ||
| pr_author: ${{ needs.find-pr.outputs.pr_author }} | ||
| actor: ${{ github.event.workflow_run.actor.login }} | ||
| secrets: | ||
| GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }} | ||
| PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} |
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
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
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
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
Oops, something went wrong.
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.