Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #10

Open
wants to merge 84 commits into
base: test1
Choose a base branch
from
Open

test #10

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3ddf4c4
test
galipremsagar Mar 28, 2024
10961f1
Merge branch 'test1' into test2
galipremsagar Mar 28, 2024
04ae07e
test
galipremsagar Mar 28, 2024
2be6444
Update copy.yml
galipremsagar Apr 1, 2024
c5bd197
Update copy.yml
galipremsagar Apr 1, 2024
9579f2b
Update copy.yml
galipremsagar Apr 1, 2024
155cc81
Update copy.yml
galipremsagar Apr 1, 2024
0840aeb
test
galipremsagar Apr 1, 2024
73a8fe9
test
galipremsagar Apr 1, 2024
5dd6b51
test
galipremsagar Apr 1, 2024
2fc4018
test
galipremsagar Apr 2, 2024
c3689c9
test
galipremsagar Apr 2, 2024
a7fac63
test
galipremsagar Apr 2, 2024
b0a3acb
test
galipremsagar Apr 2, 2024
3615d89
test
galipremsagar Apr 2, 2024
c8dde03
test
galipremsagar Apr 2, 2024
1636810
test
galipremsagar Apr 2, 2024
47ce0ad
test
galipremsagar Apr 2, 2024
0eade21
Update copy.yml
galipremsagar Apr 3, 2024
8a9f078
Update .github/workflows/copy.yml
galipremsagar Apr 3, 2024
f762b49
test
galipremsagar Apr 3, 2024
7698268
test
galipremsagar Apr 3, 2024
c6c64d0
test
galipremsagar Apr 3, 2024
039f5b0
test
galipremsagar Apr 3, 2024
d431bad
test
galipremsagar Apr 3, 2024
b4acb43
test
galipremsagar Apr 3, 2024
05a8d61
test
galipremsagar Apr 3, 2024
d88ee2c
test
galipremsagar Apr 3, 2024
df998d3
test
galipremsagar Apr 3, 2024
7e7aeeb
test
galipremsagar Apr 3, 2024
6448bc2
test
galipremsagar Apr 3, 2024
a35b5c0
test
galipremsagar Apr 3, 2024
566392d
test
galipremsagar Apr 3, 2024
c0aa332
test
galipremsagar Apr 3, 2024
7dab295
test
galipremsagar Apr 3, 2024
5fc344b
test3 (#11)
galipremsagar Apr 3, 2024
6428886
test
galipremsagar Apr 3, 2024
63ed93d
Merge branch 'test2' into test3
galipremsagar Apr 3, 2024
b48d6cb
Merge branch 'test3' of https://github.com/galipremsagar/cudf into test3
galipremsagar Apr 3, 2024
883f5ca
test
galipremsagar Apr 3, 2024
294020e
test
galipremsagar Apr 3, 2024
f29230a
Update status.yml
galipremsagar Apr 3, 2024
02ab369
Merge branch 'test2' of https://github.com/galipremsagar/cudf into test2
galipremsagar Apr 3, 2024
327a0d7
test
galipremsagar Apr 3, 2024
b926bfa
test
galipremsagar Apr 3, 2024
1105ba6
test
galipremsagar Apr 3, 2024
cf0651c
test
galipremsagar Apr 3, 2024
b0c744f
test
galipremsagar Apr 3, 2024
28c306c
test
galipremsagar Apr 3, 2024
4668d89
test
galipremsagar Apr 3, 2024
05ee02f
test
galipremsagar Apr 3, 2024
9053938
test
galipremsagar Apr 4, 2024
52dada2
test
galipremsagar Apr 4, 2024
84d0956
test
galipremsagar Apr 4, 2024
68c6254
test
galipremsagar Apr 4, 2024
0273a3d
test
galipremsagar Apr 4, 2024
4bbb668
test
galipremsagar Apr 4, 2024
042a61e
test
galipremsagar Apr 4, 2024
246db8f
test
galipremsagar Apr 4, 2024
82cbfd1
test
galipremsagar Apr 4, 2024
4692954
test
galipremsagar Apr 4, 2024
6b5e102
test
galipremsagar Apr 4, 2024
5465e0a
add permissions
galipremsagar Apr 4, 2024
19612f9
permissions
galipremsagar Apr 4, 2024
50f8f77
switch to js
galipremsagar Apr 4, 2024
7087118
test
galipremsagar Apr 5, 2024
88774fe
test
galipremsagar Apr 5, 2024
cc476cf
test
galipremsagar Apr 5, 2024
9138909
test
galipremsagar Apr 5, 2024
0bd9808
test
galipremsagar Apr 5, 2024
6942e84
logging
galipremsagar Apr 5, 2024
4a1825c
test
galipremsagar Apr 5, 2024
bf23cc5
test
galipremsagar Apr 5, 2024
9177d1f
test
galipremsagar Apr 5, 2024
3f59387
test
galipremsagar Apr 5, 2024
419d2d9
test
galipremsagar Apr 5, 2024
9958946
test
galipremsagar Apr 5, 2024
708f3ec
test
galipremsagar Apr 8, 2024
01bbe84
test
galipremsagar Apr 8, 2024
7116e6f
test
galipremsagar Apr 8, 2024
14865b3
test
galipremsagar Apr 8, 2024
a898a27
test
galipremsagar Apr 8, 2024
b80cb81
test
galipremsagar Apr 8, 2024
348d9dc
test
galipremsagar Apr 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/copy.yml

This file was deleted.

48 changes: 29 additions & 19 deletions .github/workflows/copy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,34 @@ on:
push:

jobs:
echo_job:
runs-on: ubuntu-latest
steps:
- name: Echo abc
run: echo 'abc'
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Generate text file
run: |
echo "Hello, World!" > hello.txt
- name: Upload file to GitHub Artifact
uses: actions/upload-artifact@v3
with:
name: hello-artifact
path: hello.txt
call-reusable-workflow:
uses: galipremsagar/test-actions/.github/workflows/echo_workflow.yml@main
with:
python-version: '3.x'
# echo_job:
# runs-on: ubuntu-latest
# steps:
# - name: Echo abc
# run: echo 'abc'
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.x'
# - name: Generate text file
# run: |
# echo '{"context":"Pandas tests", "description":"90/100", "state":"success", "job_name": "${{ github.job }}"}' > gh-status.json
# echo "### Hello world1! :rocket:" >> $GITHUB_STEP_SUMMARY
# - name: Upload file to GitHub Artifact1
# uses: actions/upload-artifact@v4
# with:
# name: gh-status
# path: gh-status.json
# - name: Download artifact
# uses: actions/download-artifact@v4
# with:
# name: gh-status
# path: downloaded_artifacts/

# abc
122 changes: 122 additions & 0 deletions .github/workflows/status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Process Workflow Artifacts and Update Status After Echo Job

on:
workflow_run:
workflows: ["Echo on PR"]
types:
- completed

jobs:
process_artifacts:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
artifact_downloaded: ${{ steps.download_artifact.outputs.artifact_downloaded }}
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: write
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: write
steps:
- name: Download artifact
id: download_artifact
uses: actions/github-script@v7
with:
retries: 3
script: |
const fs = require('fs');
const path = require('path');
const artifactName = 'gh-status';

const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
// Find the specific artifact
const artifact = allArtifacts.data.artifacts.find(artifact => artifact.name === artifactName);
if (!artifact) {
core.info(`Artifact "${artifactName}" not found. Exiting safely.`);
core.setOutput('artifact_downloaded', 'false');
return;
}
core.setOutput('artifact_downloaded', 'true');
// Download the artifact
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});

// Write the artifact to a file
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data));

- name: 'Unzip artifact'
if: ${{ steps.download_artifact.outputs.artifact_downloaded == 'true' }}
run: unzip 'gh-status.zip'

- name: Create status
if: ${{ steps.download_artifact.outputs.artifact_downloaded == 'true' }}
uses: actions/github-script@v7
env:
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
ATTEMPTS: ${{ github.event.workflow_run.run_attempt }}
with:
retries: 3
script: |
// Load the JSON content
const contentJSON = require('./gh-status.json');
const {
job_name: JOB_NAME,
context: CUSTOM_CONTEXT = 'Custom CI Status Check',
description: CUSTOM_DESCRIPTION = 'Custom CI Status description',
target_url: CUSTOM_TARGET_URL,
state: CUSTOM_STATE = 'success'
} = contentJSON;

// Fetch all jobs using pagination
const jobs = await github.paginate(
github.rest.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: process.env.WORKFLOW_RUN_ID,
}
);

//console.log(JSON.stringify(jobs.data.jobs, undefined, 2));
const job = jobs.find(job => job.name === JOB_NAME);
const JOB_ID = job ? job.id : null;

// Set default target URL if not defined
const targetUrl = CUSTOM_TARGET_URL || `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.WORKFLOW_RUN_ID}/attempts/${process.env.ATTEMPTS}#summary-${JOB_ID}`;

console.log("job id: ", JOB_ID);
console.log("state: ", CUSTOM_STATE);
console.log("target url: ", targetUrl);
console.log("description: ", CUSTOM_DESCRIPTION);
console.log("context: ", CUSTOM_CONTEXT);

// Create status
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: process.env.COMMIT_SHA,
state: CUSTOM_STATE,
target_url: targetUrl,
description: CUSTOM_DESCRIPTION,
context: CUSTOM_CONTEXT,
});

#abc123
Loading