Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Create npm-publish.yml#654

Open
Kevin098623 wants to merge 1 commit intoOpenZeppelin:masterfrom
Kevin098623:master
Open

Create npm-publish.yml#654
Kevin098623 wants to merge 1 commit intoOpenZeppelin:masterfrom
Kevin098623:master

Conversation

@Kevin098623
Copy link

No description provided.

Copy link
Author

@Kevin098623 Kevin098623 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kevin098623 Kevin098623 closed this Jun 1, 2025
@Kevin098623 Kevin098623 reopened this Jun 1, 2025
@Kevin098623
Copy link
Author

@Kevin098623
Copy link
Author

Approve

@Kevin098623
Copy link
Author

name: Use the data

on:
workflow_run:
workflows: [Upload data]
types:
- completed

jobs:
download:
runs-on: ubuntu-latest
steps:
- name: 'Download artifact'
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
const path = require('path');
const temp = '${{ runner.temp }}/artifacts';
if (!fs.existsSync(temp)){
fs.mkdirSync(temp);
}
fs.writeFileSync(path.join(temp, 'pr_number.zip'), Buffer.from(download.data));

  - name: 'Unzip artifact'
    run: unzip pr_number.zip -d "${{ runner.temp }}/artifacts"

  - name: 'Comment on PR'
    uses: actions/github-script@v7
    with:
      github-token: ${{ secrets.GITHUB_TOKEN }}
      script: |
        const fs = require('fs');
        const path = require('path');
        const temp = '${{ runner.temp }}/artifacts';
        const issue_number = Number(fs.readFileSync(path.join(temp, 'pr_number')));
        await github.rest.issues.createComment({
          owner: context.repo.owner,
          repo: context.repo.repo,
          issue_number: issue_number,
          body: 'Thank you for the PR!'
        });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant