Add GitHub Actions workflows for build, release, and PR download link
This commit is contained in:
36
.github/workflows/update-link-on-pr.yml
vendored
Normal file
36
.github/workflows/update-link-on-pr.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Add download link to PR
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build"]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
pr_comment:
|
||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Get PR number
|
||||
id: pr
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const pulls = await github.rest.pulls.list({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open'
|
||||
});
|
||||
const pr = pulls.data.find(p => p.head.sha === '${{ github.event.workflow_run.head_sha }}');
|
||||
if (pr) {
|
||||
core.setOutput('number', pr.number);
|
||||
}
|
||||
|
||||
- name: Add download link comment
|
||||
if: steps.pr.outputs.number
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
number: ${{ steps.pr.outputs.number }}
|
||||
message: |
|
||||
Download the plugin for this PR: [discord-rich-presence.zip](https://nightly.link/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/discord-rich-presence.zip)
|
||||
Reference in New Issue
Block a user