automatically inform authors of GitHub issues about new releases (#2685)

This commit is contained in:
Alessandro Ros 2023-11-12 21:57:55 +01:00 committed by GitHub
parent 83a3086de7
commit 4cf8948fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 17 deletions

View file

@ -1,4 +1,4 @@
name: bump-hls-js
name: bump_hls_js
on:
schedule:
@ -6,7 +6,7 @@ on:
workflow_dispatch:
jobs:
bump-hls-js:
bump_hls_js:
runs-on: ubuntu-20.04
steps:

View file

@ -1,4 +1,4 @@
name: lint
name: code_lint
on:
push:
@ -7,7 +7,7 @@ on:
branches: [ main ]
jobs:
code:
golangci_lint:
runs-on: ubuntu-22.04
steps:
@ -21,7 +21,7 @@ jobs:
with:
version: v1.55.0
mod-tidy:
mod_tidy:
runs-on: ubuntu-22.04
steps:
@ -35,7 +35,7 @@ jobs:
go mod tidy
git diff --exit-code
apidocs:
api_docs:
runs-on: ubuntu-22.04
steps:

View file

@ -1,4 +1,4 @@
name: test
name: code_test
on:
push:
@ -7,7 +7,7 @@ on:
branches: [ main ]
jobs:
test64:
test_64:
runs-on: ubuntu-22.04
steps:
@ -19,7 +19,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
test32:
test_32:
runs-on: ubuntu-22.04
steps:

View file

@ -1,11 +1,11 @@
name: issue-lint
name: issue_lint
on:
issues:
types: [opened]
jobs:
issue-lint:
issue_lint:
runs-on: ubuntu-latest
steps:

View file

@ -1,4 +1,4 @@
name: issue-lock
name: issue_lock
on:
schedule:
@ -6,7 +6,7 @@ on:
workflow_dispatch:
jobs:
issue-lock:
issue_lock:
runs-on: ubuntu-latest
steps:

View file

@ -19,13 +19,11 @@ jobs:
name: binaries
path: binaries
github:
github_release:
needs: binaries
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: binaries
@ -58,6 +56,45 @@ jobs:
});
}
github_inform_issues:
needs: github_release
runs-on: ubuntu-22.04
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { repo: { owner, repo } } = context;
const tags = await github.rest.repos.listTags({
owner,
repo,
});
const curTag = tags.data[0];
const prevTag = tags.data[1];
const diff = await github.rest.repos.compareCommitsWithBasehead({
owner,
repo,
basehead: `${prevTag.commit.sha}...${curTag.commit.sha}`,
});
for (const commit of diff.data.commits) {
for (const match of commit.commit.message.matchAll(/(^| |\()#([0-9]+)( |\)|$)/g)) {
try {
await github.rest.issues.createComment({
owner,
repo,
issue_number: parseInt(match[2]),
body: `This issue is mentioned in release ${curTag.name} 🚀\n`
+ `Check out the entire changelog by [clicking here](https://github.com/${owner}/${repo}/releases/tag/${curTag.name})`,
});
} catch (exc) {}
}
}
dockerhub:
needs: binaries
runs-on: ubuntu-22.04
@ -87,7 +124,7 @@ jobs:
DOCKER_USER_LEGACY: ${{ secrets.DOCKER_USER_LEGACY }}
DOCKER_PASSWORD_LEGACY: ${{ secrets.DOCKER_PASSWORD_LEGACY }}
apidocs:
api_docs:
needs: binaries
runs-on: ubuntu-22.04