Change "pull_request" event to "pull_request_target" (#72) #57
This file contains 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
name: Workflow Publisher | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ 'main'] | |
paths: | |
- '.github/templates/**' | |
jobs: | |
set-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: | | |
JSON=$(cat .github/workflows/repos.json) | |
echo "matrix=${JSON//'%'/'%25'}" >> $GITHUB_OUTPUT | |
publish-workflow-template: | |
needs: set-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
target_repo: ${{fromJson(needs.set-matrix.outputs.matrix)}} | |
steps: | |
- name: Checkout Workflows | |
uses: actions/checkout@v3 | |
with: | |
path: main | |
- name: Checkout target repo | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ matrix.target_repo }} | |
path: ${{ matrix.target_repo }} | |
token: ${{ secrets.OCTOKITBOT_PROJECT_ACTION_TOKEN}} | |
- name: Update workflows | |
working-directory: ./ | |
shell: bash | |
run: | | |
mkdir -p ${{ matrix.target_repo }}/.github/workflows/ | |
cp main/.github/templates/* ${{ matrix.target_repo }}/.github/workflows/ | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.OCTOKITBOT_PROJECT_ACTION_TOKEN }} | |
commit-message: "Updates for workflows" | |
title: "🚧 Workflows have changed" | |
body: "Workflow changes have been made in the Octokit org repo. This PR is propagating those changes." | |
branch: workflow-update | |
labels: "Type: Maintenance" | |
author: "Octokit Bot <[email protected]>" | |
path: ${{ matrix.target_repo }} | |