Skip to content

Commit 82e9a5e

Browse files
blakeffacebook-github-bot
authored andcommittedJan 31, 2024·
Add Github Action to mirror partner's nightly CI results (#42744)
Summary: Pull Request resolved: #42744 This adds a nightlies-feedback workflow, which our partners can get permission to mirror the results of their nightlies CI workflows. We do this to use our internal tools that are restricted to Meta owned Github projects. The benefit to partners is that they can add this step to their workflow: ``` - if: ${{ success() || failure() }} env: OUTCOME: ${{ contains(steps.*.conclusion, 'failure') && 'fail' || 'pass' }} run: | curl -X POST \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ https://api.github.com/repos/facebook/react-native/actions/workflows/nightlies-feedback.yml/dispatches \ -d "$(printf '{"ref":"main","inputs":{"outcome":"%s","stage":"needs_an_action","link":"http://github.com/some/action","version":"%s"}}' "$OUTCOME" "${{ inputs.version }}" )" ``` ### Feedback: It's complicated, but there are ways to simplify this for our users. I'd like to prove out that it's valuable first with Expo. ### Limits: There's certainly a lot of room for improvement, which we could provide with a published action (populate the ref correctly, simplify gathering the outcome, labelling of failing step correctly, etc...). ### Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D53229996 fbshipit-source-id: 10e4ba5b5fd85935b1b03aaafa41ef8b96d2faca
1 parent 7ea7904 commit 82e9a5e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
 
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Nightlies Partners Feedback
2+
env:
3+
# Add accounts for users who are part of the nightlies program
4+
allowed_users: >
5+
[
6+
"blakef",
7+
"alanjhughes"
8+
]
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
project:
13+
description: 'What project is running against the nighties build?'
14+
required: true
15+
type: string
16+
outcome:
17+
description: 'Did the CI run: ["pass", "fail"]?'
18+
required: true
19+
type: string
20+
stage:
21+
description: 'Stage in the run that failed: ["build", "test"]?'
22+
required: true
23+
type: string
24+
link:
25+
description: 'URL to the failing test'
26+
required: true
27+
type: string
28+
version:
29+
description: 'What is the Nightlies version this was run against?'
30+
required: true
31+
type: string
32+
jobs:
33+
share-nightlies-feedback:
34+
name: ${{ inputs.project}} 💨 Nightlies CI
35+
runs-on: ubuntu-latest
36+
permissions:
37+
actions: write
38+
steps:
39+
- if: ${{ !contains(fromJSON(env.allowed_users), github.actor.login) }}
40+
run: |
41+
echo "Request from actor's login wasn't on the allowed_users list."
42+
curl -X POST \
43+
-H "Accept: application/vnd.github.v3+json" \
44+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
45+
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
46+
- run: |
47+
echo "Project: ${{ inputs.project }}"
48+
echo "Outcome: ${{ inputs.outcome }}"
49+
echo "Stage: ${{ inputs.stage }}"
50+
echo "Link: ${{ inputs.link }}"
51+
echo "Version: ${{ inputs.version }}"
52+
[[ "${{ inputs.outcome }}" == "pass" ]] && { exit 0; } || { exit 1; }

0 commit comments

Comments
 (0)
Please sign in to comment.