-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (93 loc) · 3.08 KB
/
pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Update CI workflow secrets
on:
workflow_dispatch:
jobs:
# get-repositories:
# name: Get repositories list
# runs-on: ubuntu-latest
# outputs:
# list: ${{ steps.repos.outputs.result }}
# steps:
# - uses: actions/github-script@v7
# id: repos
# with:
# script: |
# async function getCustomProperties(owner, repo) {
# const customProperties = await github.request('GET /repos/{owner}/{repo}/properties/values', {
# owner: owner,
# repo: repo,
# headers: {
# 'X-GitHub-Api-Version': '2022-11-28'
# }
# })
# return Object.fromEntries(customProperties.data.map(item => [item.property_name, item.value]))
# }
# const response = await github.rest.repos.listForOrg({
# org: "retejs",
# per_page: 100
# })
# const repos = await Promise.all(response.data.map(repo => repo.name).map(async repo => {
# return {
# name: repo,
# properties: await getCustomProperties('retejs', repo)
# }
# }))
# return repos.filter(repo => repo.properties['npm-package'] === 'true').map(repo => repo.name)
# - name: Found repositories
# run: |
# echo ${{steps.repos.outputs.result}}
update-repositories:
name: Create PR for ${{ matrix.repository }} repository
# needs: get-repositories
# if: success('get-repositories')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# repository: ${{fromJson(needs.get-repositories.outputs.list)}}
repository: [test-sonar]
steps:
- name: Enter the repository
run: echo ${{ matrix.repository }}
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
repository: retejs/${{ matrix.repository }}
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Update ci.yml
run: |
cat << EOF > .github/workflows/ci.yml
name: CI
on:
workflow_dispatch:
pull_request:
branches: [ "main", "beta" ]
jobs:
ci:
uses: retejs/.github/.github/workflows/ci.yml@main
secrets: inherit
EOF
- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate_token.outputs.token }}
author: rete-js[bot] <rete-js[bot]@users.noreply.github.com>
commit-message: "ci: secrets"
title: Add secrets to CI workflow
branch: ci-secrets
body: "Bulk Rete CLI update"
reviewers: Ni55aN
- name: Add summary
run: |
echo "📰 ${{ steps.pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY