mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Update android-ci-comment.yml (#6200)
This commit is contained in:
parent
fda87b7823
commit
b2927483fa
1 changed files with 17 additions and 5 deletions
22
.github/workflows/android-ci-comment.yml
vendored
22
.github/workflows/android-ci-comment.yml
vendored
|
|
@ -1,6 +1,10 @@
|
||||||
name: Android CI Comment
|
name: Android CI Comment
|
||||||
|
|
||||||
on: [pull_request_target]
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Android CI"]
|
||||||
|
types: [completed]
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
|
|
@ -9,16 +13,17 @@ jobs:
|
||||||
comment:
|
comment:
|
||||||
name: Comment on PR with APK links
|
name: Comment on PR with APK links
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event.workflow_run.conclusion == 'success'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout base branch
|
- name: Checkout base branch
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.base_ref }}
|
ref: ${{ github.event.workflow_run.head_branch }}
|
||||||
|
|
||||||
- name: Download Run ID Artifact
|
- name: Download Run ID Artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: run-id
|
name: run-id
|
||||||
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- name: Read Run ID
|
- name: Read Run ID
|
||||||
id: read-run-id
|
id: read-run-id
|
||||||
|
|
@ -26,7 +31,7 @@ jobs:
|
||||||
|
|
||||||
- name: Comment on PR with APK download links
|
- name: Comment on PR with APK download links
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -41,6 +46,13 @@ jobs:
|
||||||
throw new Error('Run ID not found.');
|
throw new Error('Run ID not found.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the PR number from the workflow_run event
|
||||||
|
const prNumber = ${{ github.event.workflow_run.pull_requests[0].number }};
|
||||||
|
if (!prNumber) {
|
||||||
|
console.log('No PR number found in workflow_run event.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({
|
const { data: { artifacts } } = await github.rest.actions.listWorkflowRunArtifacts({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|
@ -71,7 +83,7 @@ jobs:
|
||||||
`;
|
`;
|
||||||
|
|
||||||
await github.rest.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
issue_number: context.issue.number,
|
issue_number: prNumber,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: commentBody
|
body: commentBody
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue