Skip to content

Commit

Permalink
Merge staging/4.1.5 into stable/4.1.x. Update 20240320
Browse files Browse the repository at this point in the history
* commit '79f23bb146ca5f4a0d3778164c114af16c86be8b':
  Automatically close feature branch issues (OpenSlides#238)
  Automatically create PRs for commits on staging branches (OpenSlides#236) (OpenSlides#237)
  • Loading branch information
peb-adr committed Mar 20, 2024
2 parents d12e0da + 79f23bb commit e0e1734
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/close-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
pull_request:
types:
- closed
branches:
- "feature/*"

jobs:
close-issue:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
- name: Generate access token
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}

- uses: octokit/graphql-action@v2.x
id: get-issues
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
query: |
query getLinkedIssues($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
closingIssuesReferences(first: 100) {
nodes {
number
repository {
nameWithOwner
}
}
}
}
}
}
variables: |
owner: ${{ github.event.repository.owner.name }}
repo: ${{ github.event.repository.name }}
number: ${{ github.event.pull_request.number }}
- name: Close issues
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
issue_data="$(echo "${{ steps.get-issues.outputs.data }}" | jq -r '.data.repository.pullRequest.closingIssuesReferences.nodes[] | [.number,.repository.nameWithOwner] | @tsv')"
echo "$issue_data" | while read number nameWithOwner; do
gh issue close "$number" -r "$nameWithOwner"
done

0 comments on commit e0e1734

Please sign in to comment.