|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 | pull_request: |
| 8 | + repository_dispatch: |
| 9 | + schedule: |
| 10 | + - cron: "0 5 * * 1" |
| 11 | + workflow_dispatch: |
8 | 12 |
|
9 | 13 | jobs: |
10 | | - lint: |
11 | | - runs-on: ubuntu-latest |
12 | | - steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - - name: Setup Node.js |
15 | | - uses: actions/setup-node@v4 |
16 | | - with: |
17 | | - node-version: "20" |
18 | | - - name: Install dependencies |
19 | | - run: yarn |
20 | | - - name: Run tests |
21 | | - run: yarn lint |
22 | | - |
23 | | - check-dist: |
24 | | - runs-on: ubuntu-latest |
25 | | - steps: |
26 | | - - uses: actions/checkout@v4 |
27 | | - - name: Setup Node.js |
28 | | - uses: actions/setup-node@v4 |
29 | | - with: |
30 | | - node-version: "20" |
31 | | - - name: Install dependencies |
32 | | - run: yarn |
33 | | - - name: Rebuild the dist/ directory |
34 | | - run: yarn build |
35 | | - - name: Compare the expected and actual dist/ directories |
36 | | - run: | |
37 | | - if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then |
38 | | - echo "Detected uncommitted changes after build. See status below:" |
39 | | - git diff |
40 | | - exit 1 |
41 | | - fi |
42 | | -
|
43 | | - patcher-report: |
| 14 | + patcher: |
44 | 15 | if: github.event_name == 'repository_dispatch' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' |
45 | | - runs-on: ubuntu-latest |
46 | | - outputs: |
47 | | - spec: ${{ steps.get-spec.outputs.spec }} |
48 | | - steps: |
49 | | - - uses: actions/checkout@v4 |
50 | | - |
51 | | - - name: Fetch Pipelines Read Token |
52 | | - id: pipelines-read-token |
53 | | - uses: gruntwork-io/pipelines-credentials@main |
54 | | - with: |
55 | | - PIPELINES_TOKEN_PATH: "pipelines-read/gruntwork-io" |
56 | | - FALLBACK_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} |
57 | | - |
58 | | - - uses: ./ |
59 | | - id: get-spec |
60 | | - with: |
61 | | - patcher_command: report |
62 | | - PIPELINES_READ_TOKEN: ${{ steps.pipelines-read-token.outputs.PIPELINES_TOKEN }} |
63 | | - include_dirs: "infrastructure-live/**" |
64 | | - working_dir: ${{ github.workspace }} |
65 | | - spec_file: /tmp/patcher-spec.json |
66 | | - |
67 | | - update-env: |
68 | | - needs: [patcher-report] |
69 | | - runs-on: ubuntu-latest |
70 | | - strategy: |
71 | | - fail-fast: false |
72 | | - matrix: |
73 | | - dependency: ${{ fromJson(needs.patcher-report.outputs.spec).Dependencies }} |
74 | | - steps: |
75 | | - - uses: actions/checkout@v4 |
76 | | - |
77 | | - - name: Fetch Pipelines Read Token |
78 | | - id: pipelines-read-token |
79 | | - uses: gruntwork-io/pipelines-credentials@main |
80 | | - with: |
81 | | - PIPELINES_TOKEN_PATH: "pipelines-read/gruntwork-io" |
82 | | - FALLBACK_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} |
83 | | - |
84 | | - - name: Fetch Pipelines Execute Token |
85 | | - id: pipelines-infra-root-write-token |
86 | | - uses: gruntwork-io/pipelines-credentials@main |
87 | | - with: |
88 | | - PIPELINES_TOKEN_PATH: "infra-root-write/${{ github.repository_owner }}" |
89 | | - FALLBACK_TOKEN: ${{ secrets.INFRA_ROOT_WRITE_TOKEN }} |
90 | | - |
91 | | - - name: Create the spec file |
92 | | - shell: bash |
93 | | - run: | |
94 | | - echo '${{ needs.patcher-report.outputs.spec }}' > /tmp/patcher-spec.json |
95 | | -
|
96 | | - - uses: ./ |
97 | | - with: |
98 | | - patcher_command: update |
99 | | - PIPELINES_READ_TOKEN: ${{ steps.pipelines-read-token.outputs.PIPELINES_TOKEN }} |
100 | | - PIPELINES_EXECUTE_TOKEN: ${{ steps.pipelines-infra-root-write-token.outputs.PIPELINES_TOKEN }} |
101 | | - working_dir: ${{ github.workspace }} |
102 | | - dependency: ${{ matrix.dependency.ID }} |
103 | | - spec_file: /tmp/patcher-spec.json |
104 | | - pull_request_title: "[Patcher] [dev] Update ${{ matrix.dependency.ID }}" |
105 | | - pull_request_branch: "${{ env.PR_BRANCH_PREFIX }}${{ matrix.dependency.ID }}" |
106 | | - dry_run: true |
| 16 | + uses: ./.github/workflows/patcher.yml |
| 17 | + with: |
| 18 | + include_dirs: "infrastructure-live/**" |
| 19 | + dry_run: true |
| 20 | + secrets: |
| 21 | + PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} |
| 22 | + PR_CREATE_TOKEN: ${{ secrets.PR_CREATE_TOKEN }} |
0 commit comments