-
-
Notifications
You must be signed in to change notification settings - Fork 64
[ci] Added automated backport workflow #208
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||||||||||||||||
|
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. Pin the reusable workflow to a commit SHA, not Both job references use a mutable branch pointer. Any push to the Pin each call to a specific commit SHA and track the SHA deliberately: 🔒 Proposed fix: pin to a commit SHA- uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
+ uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@<COMMIT_SHA> # renovate: tag=masterAlso applies to: 37-37 🤖 Prompt for AI Agents |
||||||||||||||||
| 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' && | ||||||||||||||||
|
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. 🧹 Nitpick | 🔵 Trivial Redundant
♻️ Proposed cleanup 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')📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| 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 }} | ||||||||||||||||
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.
Concurrency key serializes all backport jobs regardless of PR — cross-event collision too.
For both
pushandissue_commentevents targetingmaster/main,github.refresolves to the same default-branch ref (e.g.refs/heads/master). This means every workflow run — whether triggered by a push or a PR comment — lands in the identical concurrency group. Withcancel-in-progress: falseall concurrent backport runs queue up sequentially, including backport commands on different, unrelated PRs.The fix is to move
concurrencyto each job and use a key that naturally scopes to the triggering entity:⚙️ Proposed fix: job-level concurrency with distinct keys
🤖 Prompt for AI Agents