Skip to content

Commit

Permalink
ci: Add postCommit workflow dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnAngela committed Jan 23, 2024
1 parent df7bb24 commit c4fa510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/generatePolyfill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ jobs:
- name: Show git status & push
id: output
run: node scripts/postCommit/push.js
env:
DISPATCH_POST_COMMIT_WORKFLOW: true
9 changes: 8 additions & 1 deletion scripts/postCommit/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import console from "../modules/console.js";
console.info("Initialization done.");
import { startGroup, endGroup } from "@actions/core";
import git from "../modules/git.js";
import { isInGithubActions } from "../modules/octokit.js";
import { isInGithubActions, octokit } from "../modules/octokit.js";
import readWorkflowEvent from "../modules/workflowEvent.js";
import upstream from "../modules/getUpstream.js";
if (!isInGithubActions) {
Expand Down Expand Up @@ -37,3 +37,10 @@ console.info("Pulling new commits...");
console.info("Successfully pulled the commits:", await git.pull(undefined, undefined, ["--rebase"]));
console.info("Pushing these commits...");
console.info("Successfully pushed the commits:", await git.push());
if (process.env.DISPATCH_POST_COMMIT_WORKFLOW === "true") {
console.info("Dispatching postCommit workflow...");
await octokit.rest.actions.createWorkflowDispatch({
workflow_id: ".github/workflows/postCommit.yaml",
ref: upstream,
});
}

0 comments on commit c4fa510

Please sign in to comment.