Skip to content

Commit

Permalink
Github Actions - Link Artifacts in PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdCopter committed Feb 21, 2024
1 parent b6c56f1 commit 3d370c8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,27 @@ jobs:
name: ${{ env.ARTIFACT_NAME }}
path: obj/*.hex

artifacts:
if: github.event_name == 'pull_request'
needs: build

# Hide existing/outdated artifacts links
- name: Hide artifacts links from comments.
uses: int128/hide-comment-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
authors: "github-actions"
contains: "Compiled HEX from this Pull-Request. WARNING: No warranty or guarantee of any kind. Test/Fly at your own risk!"
continue-on-error: true

# Add artifacts links to comments
- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync(`./${ARTIFACT_NAME}`));
let issue_number = Number(fs.readFileSync(`./${{ env.ARTIFACT_NAME }}`));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit 3d370c8

Please sign in to comment.