Skip to content

Commit 4686b7f

Browse files
authored
Merge pull request #26 from ThePythonLedger/main
Pull changes to workflow
2 parents 360c84d + eb5a2f9 commit 4686b7f

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

‎.github/workflows/preview_pages_managment.yml‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ jobs:
6262
core.setOutput('sha', pr.data.head.sha);
6363
core.setOutput('ref', pr.data.head.ref);
6464
core.setOutput('pr_author', pr.data.user.login);
65-
66-
- name: Delete triggering /preview comment
67-
uses: actions/github-script@v7
68-
with:
69-
script: |
70-
await github.rest.issues.deleteComment({
71-
owner: context.repo.owner,
72-
repo: context.repo.repo,
73-
comment_id: context.payload.comment.id,
74-
});
7565
7666
- name: Post "Preview building" comment
7767
id: create_comment
@@ -90,10 +80,20 @@ jobs:
9080
owner: context.repo.owner,
9181
repo: context.repo.repo,
9282
issue_number: context.issue.number,
93-
body: `⏳ **Preview building...**`,
83+
body: `⏳ **Preview building...**\n\ncc ${mentions}`,
9484
});
9585
core.setOutput('comment_id', comment.id);
9686
87+
- name: Delete triggering /preview comment
88+
uses: actions/github-script@v7
89+
with:
90+
script: |
91+
await github.rest.issues.deleteComment({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
comment_id: context.payload.comment.id,
95+
});
96+
9797
deploy-preview:
9898
name: Deploy Preview to Cloudflare Pages
9999
needs: [check-permission, notify-preview-start]
@@ -102,18 +102,17 @@ jobs:
102102
pull-requests: write
103103
contents: read
104104
steps:
105-
- name: Checkout Engine
105+
- name: Checkout Engine (PR Code)
106106
uses: actions/checkout@v4
107107
with:
108108
path: engine
109-
repository: ThePythonLedger/Docusaurus-engine
110-
111-
- name: Checkout Curriculum (PR Code)
109+
ref: ${{ needs.notify-preview-start.outputs.sha }}
110+
111+
- name: Checkout Curriculum
112112
uses: actions/checkout@v4
113113
with:
114114
path: Curriculum
115115
repository: ThePythonLedger/Curriculum
116-
ref: ${{ needs.notify-preview-start.outputs.sha }}
117116

118117
- name: Setup Node.js
119118
uses: actions/setup-node@v4
@@ -137,7 +136,7 @@ jobs:
137136
with:
138137
apiToken: ${{ secrets.CF_API_TOKEN }}
139138
accountId: ${{ secrets.CF_ACCOUNT_ID }}
140-
command: pages deploy engine/build --project-name=python-ledger-preview --branch=pr-${{ needs.notify-preview-start.outputs.pr_num }}
139+
command: pages deploy engine/build --project-name=python-ledger-preview --branch=engine-pr-${{ needs.notify-preview-start.outputs.pr_num }}
141140

142141
- name: Update Preview Comment with Link
143142
uses: actions/github-script@v7
@@ -146,7 +145,7 @@ jobs:
146145
const prNumber = ${{ needs.notify-preview-start.outputs.pr_num }};
147146
const prAuthor = "${{ needs.notify-preview-start.outputs.pr_author }}";
148147
const triggerUser = context.actor;
149-
const previewUrl = `https://pr-${prNumber}.python-ledger-preview.pages.dev`;
148+
const previewUrl = `https://engine-pr-${prNumber}.python-ledger-preview.pages.dev`;
150149
151150
let mentions = `@${triggerUser}`;
152151
if (prAuthor && prAuthor !== triggerUser) {
@@ -184,12 +183,12 @@ jobs:
184183
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
185184
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
186185
run: |
187-
BRANCH_NAME="pr-${{ github.event.number }}"
186+
BRANCH_NAME="engine-pr-${{ github.event.number }}"
188187
PROJECT_NAME="python-ledger-preview"
189188
190189
echo "Deleting Cloudflare Pages branch: $BRANCH_NAME"
191190
192191
curl -s -X DELETE \
193192
"https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/pages/projects/${PROJECT_NAME}/branches/${BRANCH_NAME}" \
194193
-H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
195-
-H "Content-Type: application/json"
194+
-H "Content-Type: application/json"

0 commit comments

Comments
 (0)