Skip to content

Commit

Permalink
fix rev (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadin-Starkware authored Oct 22, 2024
1 parent f3f2017 commit 661d0e3
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions .github/workflows/updload_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,29 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: set env vars
# if: github.event.workflow_run.pull_requests != ''
run: |
pr_number=$(gh pr list --head "${{ github.event.workflow_run.head_branch }}" --json number --jq '.[0].number')
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo "WORKFLOW_LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "The workflow run URL is: $GITHUB_RUN_URL"
- name: Add a comment to the PR
if: env.PR_NUMBER != '' && env.WORKFLOW_LINK != ''
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const workflowLink = process.env.WORKFLOW_LINK;
github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Artifacts upload triggered. [View details here](${workflowLink})`
})
- name: Commit hash - 1
# if: ${{ github.event_name == 'pull_request' }}
env:
Expand All @@ -34,40 +57,13 @@ jobs:
echo "The workflow run number is: ${{ github.run_number }}"
echo "The workflow run name is: ${{ github.run_id }}"
- name: Set GH_TOKEN for GitHub CLI
run: echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Get PR Number 1
# if: github.event.workflow_run.pull_requests != ''
run: |
pr_number=$(gh pr list --head "${{ github.event.workflow_run.head_branch }}" --json number --jq '.[0].number')
echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV
echo "WORKFLOW_LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
echo "The workflow run URL is: $GITHUB_RUN_URL"
- name: Checkout repository
uses: actions/checkout@v3

# - name: Get Pull Request Number - 2
# id: get_pr
# run: |
# pr=39
# echo "PR_NUMBER=$pr" >> $GITHUB_ENV
# echo "pr num is: $pr"

- name: Add a comment to the PR
if: env.PR_NUMBER != '' && env.WORKFLOW_LINK != ''
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const workflowLink = process.env.WORKFLOW_LINK;
github.rest.issues.createComment({
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Artifacts upload triggered. View details here: ${workflowLink}`
})


- name: Authenticate with GCS
uses: "google-github-actions/auth@v2"
Expand Down

0 comments on commit 661d0e3

Please sign in to comment.