-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: postinstall for dependabot template-oss PR
- Loading branch information
1 parent
2a9eb7e
commit 58d46b2
Showing
4 changed files
with
149 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,39 @@ jobs: | |
run: | ||
shell: bash | ||
steps: | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
|
||
id: check-output | ||
env: | ||
JOB_NAME: "Lint All" | ||
MATRIX_NAME: "" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
|
@@ -30,12 +63,7 @@ jobs: | |
status: in_progress | ||
name: Lint All | ||
sha: ${{ inputs.check-sha }} | ||
# XXX: this does not work when using the default GITHUB_TOKEN. | ||
# Instead we post the main job url to the PR as a comment which | ||
# will link to all the other checks. To work around this we would | ||
# need to create a GitHub that would create on-demand tokens. | ||
# https://github.com/LouisBrunner/checks-action/issues/18 | ||
# details_url: | ||
output: ${{ steps.check-output.outputs.result }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
|
@@ -94,6 +122,39 @@ jobs: | |
run: | ||
shell: ${{ matrix.platform.shell }} | ||
steps: | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
|
||
id: check-output | ||
env: | ||
JOB_NAME: "Test All" | ||
MATRIX_NAME: " - ${{ matrix.platform.name }} - ${{ matrix.node-version }}" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ inputs.check-sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
|
@@ -103,12 +164,7 @@ jobs: | |
status: in_progress | ||
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }} | ||
sha: ${{ inputs.check-sha }} | ||
# XXX: this does not work when using the default GITHUB_TOKEN. | ||
# Instead we post the main job url to the PR as a comment which | ||
# will link to all the other checks. To work around this we would | ||
# need to create a GitHub that would create on-demand tokens. | ||
# https://github.com/LouisBrunner/checks-action/issues/18 | ||
# details_url: | ||
output: ${{ steps.check-output.outputs.result }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
@@ -51,17 +52,19 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npx --offline template-oss-release-please ${{ github.ref_name }} | ||
npx --offline template-oss-release-please ${{ github.ref_name }} ${{ github.event_name }} | ||
- name: Post Pull Request Comment | ||
if: steps.release.outputs.pr-number | ||
uses: actions/github-script@v6 | ||
id: pr-comment | ||
env: | ||
PR_NUMBER: ${{ steps.release.outputs.pr-number }} | ||
REF_NAME: ${{ github.ref_name }} | ||
with: | ||
script: | | ||
const { REF_NAME, PR_NUMBER } = process.env | ||
const repo = { owner: context.repo.owner, repo: context.repo.repo } | ||
const issue = { ...repo, issue_number: process.env.PR_NUMBER } | ||
const issue = { ...repo, issue_number: PR_NUMBER } | ||
const { data: workflow } = await github.rest.actions.getWorkflowRun({ ...repo, run_id: context.runId }) | ||
|
@@ -70,7 +73,11 @@ jobs: | |
const comments = await github.paginate(github.rest.issues.listComments, issue) | ||
let commentId = comments?.find(c => c.user.login === 'github-actions[bot]' && c.body.startsWith(body))?.id | ||
body += `- Release workflow run: ${workflow.html_url}` | ||
body += `Release workflow run: ${workflow.html_url}\n\n#### Force CI to Rerun for This Release\n\n` | ||
body += `This PR will be updated and CI will run for every non-\`chore:\` commit that is pushed to \`main\`. ` | ||
body += `To force CI to rerun, run this command:\n\n` | ||
body += `\`\`\`\ngh workflow run release.yml -r ${REF_NAME}\n\`\`\`` | ||
if (commentId) { | ||
await github.rest.issues.updateComment({ ...repo, comment_id: commentId, body }) | ||
} else { | ||
|
@@ -79,6 +86,39 @@ jobs: | |
} | ||
return commentId | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
if: steps.release.outputs.pr-number | ||
id: check-output | ||
env: | ||
JOB_NAME: "Release" | ||
MATRIX_NAME: "" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ steps.release.outputs.pr-sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
|
@@ -88,12 +128,7 @@ jobs: | |
status: in_progress | ||
name: Release | ||
sha: ${{ steps.release.outputs.pr-sha }} | ||
# XXX: this does not work when using the default GITHUB_TOKEN. | ||
# Instead we post the main job url to the PR as a comment which | ||
# will link to all the other checks. To work around this we would | ||
# need to create a GitHub that would create on-demand tokens. | ||
# https://github.com/LouisBrunner/checks-action/issues/18 | ||
# details_url: | ||
output: ${{ steps.check-output.outputs.result }} | ||
|
||
update: | ||
needs: release | ||
|
@@ -142,6 +177,39 @@ jobs: | |
git commit --all --amend --no-edit || true | ||
git push --force-with-lease | ||
echo "::set-output name=sha::$(git rev-parse HEAD)" | ||
- name: Get Workflow Job | ||
uses: actions/github-script@v6 | ||
|
||
id: check-output | ||
env: | ||
JOB_NAME: "Update - Release" | ||
MATRIX_NAME: "" | ||
with: | ||
script: | | ||
const { owner, repo } = context.repo | ||
const { data } = await github.rest.actions.listJobsForWorkflowRun({ | ||
owner, | ||
repo, | ||
run_id: context.runId, | ||
per_page: 100 | ||
}) | ||
const jobName = process.env.JOB_NAME + process.env.MATRIX_NAME | ||
const job = data.jobs.find(j => j.name.endsWith(jobName)) | ||
const jobUrl = job?.html_url | ||
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/${{ steps.commit.outputs.sha }}` | ||
let summary = `This check is assosciated with ${shaUrl}\n\n` | ||
if (jobUrl) { | ||
summary += `For run logs, click here: ${jobUrl}` | ||
} else { | ||
summary += `Run logs could not be found for a job with name: "${jobName}"` | ||
} | ||
return { summary } | ||
- name: Create Check | ||
uses: LouisBrunner/[email protected] | ||
id: check | ||
|
@@ -151,12 +219,7 @@ jobs: | |
status: in_progress | ||
name: Release | ||
sha: ${{ steps.commit.outputs.sha }} | ||
# XXX: this does not work when using the default GITHUB_TOKEN. | ||
# Instead we post the main job url to the PR as a comment which | ||
# will link to all the other checks. To work around this we would | ||
# need to create a GitHub that would create on-demand tokens. | ||
# https://github.com/LouisBrunner/checks-action/issues/18 | ||
# details_url: | ||
output: ${{ steps.check-output.outputs.result }} | ||
- name: Conclude Check | ||
uses: LouisBrunner/[email protected] | ||
if: always() | ||
|
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