Let danger run on pull_request_target (#34370)

Summary:
This is a nit. Did some cleanups on our Danger setup.
The most substantial work is:
- Moved over danger to run on `pull_request_target`. This allow us to re-use the Github Action access token without having to provide one.
- Fixed an issue with the `Pick Request` label which was not applied correctly.
- Removed the danger_id as we were not passing it correctly.

## Changelog

[Internal] - Let danger run on `pull_request_target`

Pull Request resolved: https://github.com/facebook/react-native/pull/34370

Test Plan: Tested locally with `yarn danger pr https://github.com/facebook/react-native/pull/34197`

Reviewed By: cipolleschi

Differential Revision: D38533144

Pulled By: cortinico

fbshipit-source-id: 178ce411eb956870563c4d51719ed4dae1f1536d
This commit is contained in:
Nicola Corti
2022-08-09 06:34:32 -07:00
committed by Facebook GitHub Bot
parent da961f480b
commit 665b5bedd3
3 changed files with 24 additions and 23 deletions
+12 -8
View File
@@ -1,24 +1,28 @@
name: Run Danger on PR
on:
pull_request:
pull_request_target:
types: [opened, edited, reopened, synchronize]
permissions:
contents: read
actions: write
checks: write
contents: write
issues: write
pull-requests: write
statuses: write
jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: yarn install
- name: Run Yarn Install on Root
run: yarn install
working-directory: .
- run: yarn install
- name: Run Yarn Install inside Bots
run: yarn install
working-directory: bots
- name: Danger
run: DANGER_GITHUB_API_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" yarn danger ci --use-github-checks --failOnErrors --id danger_pr
run: yarn danger ci --use-github-checks --failOnErrors
working-directory: bots
env:
PUBLIC_PULLBOT_GITHUB_TOKEN_A: a6edf8e8d40ce4e8b11a
PUBLIC_PULLBOT_GITHUB_TOKEN_B: 150e1341f4dd9c944d2a