-
-
Notifications
You must be signed in to change notification settings - Fork 49
[ci] Added automated backport workflow #203
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 all 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. 🧩 Analysis chain🏁 Script executed: head -40 .github/workflows/backport.yml | cat -nRepository: openwisp/django-loci Length of output: 1510 Pin the reusable workflow to a commit SHA instead of Pinning an action to a full-length commit SHA is the only way to use an action as an immutable release. Using This applies to both line 22 ( Example fix- uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master
+ uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@<FULL_COMMIT_SHA>Consider adding Dependabot configuration for 🤖 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' && | ||
|
Comment on lines
+33
to
+34
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
A merged PR ( ♻️ Suggested cleanup 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) &&🤖 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 doesn't distinguish between comment-triggered runs for different PRs.
issue_commentevents run in the context of the default branch, meaninggithub.refalways resolves to e.g.refs/heads/masterregardless of which PR received the comment. With the current key, all comment-triggered backport runs — even those for completely unrelated PRs — share a single concurrency slot and queue behind one another. Additionally, a push event and a comment event on master would also collide into the same group.Include the PR number (for comment events) or
github.sha(for push events) to produce distinct concurrency groups per operation:♻️ Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents