refactor(webauto-ci): migrate autoware-setup to install_dev_env #2352
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file is automatically synced from: | |
| # https://github.com/autowarefoundation/sync-file-templates | |
| # To make changes, update the source repository and follow the guidelines in its README. | |
| name: backport | |
| on: | |
| pull_request_target: | |
| types: | |
| - closed | |
| - labeled | |
| jobs: | |
| backport: | |
| runs-on: ubuntu-22.04 | |
| # Only react to merged PRs for security reasons. | |
| # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. | |
| if: > | |
| github.event.pull_request.merged | |
| && ( | |
| github.event.action == 'closed' | |
| || ( | |
| github.event.action == 'labeled' | |
| && contains(github.event.label.name, 'backport') | |
| ) | |
| ) | |
| steps: | |
| - name: Generate token | |
| id: generate-token | |
| uses: tibdex/github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| private_key: ${{ secrets.PRIVATE_KEY }} | |
| - uses: tibdex/backport@v2 | |
| id: backport | |
| with: | |
| github_token: ${{ steps.generate-token.outputs.token }} | |
| title_template: "<%= title %> (backport #<%= number %>)" | |
| - name: Request review from original author | |
| env: | |
| GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
| PR_JSON: ${{ steps.backport.outputs.created_pull_requests }} | |
| ORIGINAL_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| run: | | |
| set -e | |
| echo "Created PRs JSON: $PR_JSON" | |
| echo "Original PR Author: $ORIGINAL_AUTHOR" | |
| # Use 'jq' to parse the JSON and extract all PR numbers | |
| pr_numbers=($(echo "$PR_JSON" | jq -r 'to_entries | .[] | .value')) | |
| # Loop through the array of PR numbers | |
| for pr_num in "${pr_numbers[@]}"; do | |
| if [ -n "$pr_num" ]; then | |
| echo "Requesting review for PR #$pr_num from $ORIGINAL_AUTHOR..." | |
| gh pr edit "$pr_num" --add-reviewer "$ORIGINAL_AUTHOR" --repo "${{ github.repository }}" | |
| fi | |
| done |