-
Hi, we just built a workflow to build a preview version in a pull-request, and push this build to our download server: https://github.com/deltachat/deltachat-desktop/blob/master/.github/workflows/build-preview.yml Part of the workflow is that we want to provide the download links to the contributors directly. Right now we do this by posting a comment to the PR, but it’s very noisy to have a comment for every commit. Instead we’d like to display the download links in the checks overview below, e.g. where it says “Details”. Is there a way to do this conveniently? I couldn’t find anything in the documentation, neither could I find an Action or Job which does it already, there is only the one for posting comments. |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
You can post it to GitHubs API yourself. We have som project where we do something along this (shell script):
(ok, we do that from CircleCI but I think you should be able to do it from an action as well. |
Beta Was this translation helpful? Give feedback.
-
cool, will try it out! |
Beta Was this translation helpful? Give feedback.
-
Hm, I’m playing around with it, but the API doesn’t seem to do anything. Neither does it give me a proper error message. Where would the message pop up? Do I need to use a user with write access to the repository, or is it okay to use the Github actions bot for this? Or is there something else I did wrong? The request itself looks fine to me in the logs: https://github.com/deltachat/deltachat-desktop/pull/1116/checks?check_run_id=291090229 |
Beta Was this translation helpful? Give feedback.
-
Weird. I think somethings wrong with SHA, but cannot figure out why. Your action posts the status to the SHA c239d9ac7d5b5a47d2fc28892c55cdd226facd2c but I can’t find that SHA in repos / in the PR. From the PR it looks like the SHA should be ae82c8b4a7b9f74672bf5881b0095141f1aac700. |
Beta Was this translation helpful? Give feedback.
-
Hm, this seems to be the merge commit which would be generated when the PR would be merged after this commit: https://github.com/deltachat/deltachat-desktop/tree/c239d9ac7d5b5a47d2fc28892c55cdd226facd2c I read something in this direction in some thread. I guess I need that commit ID so the build job can be referenced correctly? |
Beta Was this translation helpful? Give feedback.
-
Could it be github.ref instaed of github.sha? I had a debug dump of the github context somewhere but can’t find it … Nah… It should be github.sha … I made a test over at arnested/playground#4 and github.sha corresponds to the commit in PR … weird |
Beta Was this translation helpful? Give feedback.
-
Posting a status worked for me in: arnested/playground#5 Still no clue on what’s different in your example… |
Beta Was this translation helpful? Give feedback.
-
Ah, the difference is that you are using a push event, not a pull-request event. push events don’t create a merge commit, but use just their own commit’s SHA. PR events create a merge commit and use that SHA. The best solution would probably be if the API would answer to the merge commit’s SHA. Do you know where I could open an issue for that? |
Beta Was this translation helpful? Give feedback.
-
I got it! I could get the SHA from the PR event: https://github.com/deltachat/deltachat-desktop/pull/1116/files Thanks so much for taking your time to debug this with me! I learned a lot. |
Beta Was this translation helpful? Give feedback.
-
Cool. I didn’t notice yours was triggered on a pull_request event. I dived a bit more into it. It appears you can the right SHA in a pull request from ${{ github.event.after }} (can also be used on push events).${{ github.event.head_commit.id }}also looks like a possibility. I made a new PR for testing this: arnested/playground#6 There is two workflows: one triggering on push and one on pull_request. Both dumps the the context for debugging and both post a status. |
Beta Was this translation helpful? Give feedback.
-
Uh, great. I will refactor my code I guess, that is way more beautiful. |
Beta Was this translation helpful? Give feedback.
-
Note for later reference; all three solutions have the problem that they can’t get the commit sha for the first commit in a PR. I tried all of them:
If someone finds a solution in the future, let me know 😉 |
Beta Was this translation helpful? Give feedback.
Posting a status worked for me in: arnested/playground#5
Still no clue on what’s different in your example…