Skip to content

Commit e378cb1

Browse files
feat: v2 workflows
1 parent a8c65b6 commit e378cb1

4 files changed

Lines changed: 112 additions & 105 deletions

File tree

.github/workflows/build-auto-generated-files-v2.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,22 @@
22
name: Build Auto-Generated Files
33
on:
44
workflow_call:
5-
5+
inputs:
6+
baseSha:
7+
type: string
8+
required: false
9+
buildAll:
10+
type: boolean
11+
required: false
12+
default: false
613
jobs:
714
build-contributors:
815
name: Build Contributors
916
if: github.repository != 'AdobeDocs/dev-docs-template'
10-
uses: ./.github/workflows/build-contributors.yml
17+
uses: ./.github/workflows/build-contributors-v2.yml
18+
with:
19+
baseSha: ${{ inputs.baseSha }}
20+
buildAll: ${{ inputs.buildAll }}
1121
secrets: inherit
1222

1323
build-site-metadata:
@@ -16,4 +26,5 @@ jobs:
1626
if: |
1727
always() &&
1828
github.repository != 'AdobeDocs/dev-docs-template'
19-
uses: ./.github/workflows/build-site-metadata.yml
29+
uses: ./.github/workflows/build-site-metadata-v2.yml
30+
secrets: inherit

.github/workflows/build-contributors-v2.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
name: Build Contributors
33
on:
44
workflow_call:
5-
5+
inputs:
6+
baseSha:
7+
type: string
8+
required: false
9+
buildAll:
10+
type: boolean
11+
required: false
12+
default: false
613
jobs:
714
build-contributors:
815
runs-on: ubuntu-latest
@@ -12,8 +19,8 @@ jobs:
1219
- name: Checkout
1320
uses: actions/checkout@v4
1421
with:
15-
ref: ${{ github.head_ref }}
1622
fetch-depth: 0
23+
persist-credentials: false
1724

1825
- name: Generate GitHub App token
1926
id: app-token
@@ -23,15 +30,17 @@ jobs:
2330
private-key: ${{ secrets.ADP_DEVSITE_APP_PRIVATE_KEY }}
2431

2532
- name: Build Contributors
26-
run: npx --yes github:AdobeDocs/adp-devsite-utils buildContributors -v
33+
run: npx --yes github:AdobeDocs/adp-devsite-utils buildContributorsV2 -v ${{ inputs.buildAll && '--all' || '' }}
2734
env:
2835
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
36+
BASE_SHA: ${{ inputs.baseSha || github.event.before }}
2937

3038
- name: Commit and push if changed
3139
run: |
3240
git config user.name "github-actions[bot]"
3341
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}
3443
git add src/pages/contributors.json
35-
git diff --cached --quiet || git commit -m "Generate contributors"
36-
git pull --rebase
44+
git pull
45+
git diff --cached --quiet || git commit -m "chore: auto-generate contributors"
3746
git push

.github/workflows/build-site-metadata-v2.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
name: Build Site Metadata
33
on:
44
workflow_call:
5-
65
jobs:
76
build-site-metadata:
87
runs-on: ubuntu-latest
@@ -12,7 +11,14 @@ jobs:
1211
- name: Checkout
1312
uses: actions/checkout@v4
1413
with:
15-
ref: ${{ github.head_ref }}
14+
persist-credentials: false
15+
16+
- name: Generate GitHub App token
17+
id: app-token
18+
uses: actions/create-github-app-token@v1
19+
with:
20+
app-id: ${{ secrets.ADP_DEVSITE_APP_ID }}
21+
private-key: ${{ secrets.ADP_DEVSITE_APP_PRIVATE_KEY }}
1622

1723
- name: Build Site Metadata
1824
run: npx --yes github:AdobeDocs/adp-devsite-utils buildSiteMetadata -v
@@ -21,7 +27,8 @@ jobs:
2127
run: |
2228
git config user.name "github-actions[bot]"
2329
git config user.email "github-actions[bot]@users.noreply.github.com"
30+
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}
2431
git add src/pages/adp-site-metadata.json
25-
git diff --cached --quiet || git commit -m "Generate site metadata"
26-
git pull --rebase
32+
git pull
33+
git diff --cached --quiet || git commit -m "chore: auto-generate site metadata"
2734
git push

0 commit comments

Comments
 (0)