From e4aca7f1370494596e63abfa661164afea69cd8e Mon Sep 17 00:00:00 2001 From: Binita Date: Wed, 3 Jul 2024 10:44:46 -0500 Subject: [PATCH] change the workflow file --- .github/workflows/banner.yaml | 57 +++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/.github/workflows/banner.yaml b/.github/workflows/banner.yaml index 000910a..502785a 100644 --- a/.github/workflows/banner.yaml +++ b/.github/workflows/banner.yaml @@ -1,8 +1,47 @@ +#name: Update banner +# +#on: +# issues: +# # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues +# types: +# - opened +# - edited +# - reopened +# - labeled +# +#jobs: +# update_files: +# runs-on: ubuntu-latest +# name: Convert New Issue to GHG Dashboard Dynamic Data +# # require a `banner` label for moderation +# if: contains( github.event.issue.labels.*.name, 'banner') +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# - name: GitHub Issue to JSON +# uses: zachleat/github-issue-to-json-file@v3.0.14 +# with: +# # This tells the action which GitHub Issue Form template file to use +# issue-template: "banner.yaml" +# # This controls which property we use to key the file name hash off of (values should be unique in your data set) +# hash-property-name: "url" +# +# - name: Update the existing files +# run: python banner.py +# +# - name: Commit files +# run: | +# git config --local user.email "action@github.com" +# git config --local user.name "GitHub Action" +# git checkout -b staging +# git add banner.json +# git commit -m "Updating banner for #${{ env.IssueNumber }}" +# git push + name: Update banner on: issues: - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues types: - opened - edited @@ -13,19 +52,19 @@ jobs: update_files: runs-on: ubuntu-latest name: Convert New Issue to GHG Dashboard Dynamic Data - # require a `banner` label for moderation - if: contains( github.event.issue.labels.*.name, 'banner') + if: contains(github.event.issue.labels.*.name, 'banner') steps: - name: Checkout uses: actions/checkout@v3 + - name: GitHub Issue to JSON uses: actions/github-script@v6 -# uses: zachleat/github-issue-to-json-file@v3.0.14 with: - # This tells the action which GitHub Issue Form template file to use - issue-template: "banner.yaml" - # This controls which property we use to key the file name hash off of (values should be unique in your data set) - hash-property-name: "url" + script: | + const fs = require('fs'); + const issue = context.payload.issue; + const jsonContent = JSON.stringify(issue, null, 2); + fs.writeFileSync('banner.json', jsonContent); - name: Update the existing files run: python banner.py @@ -36,5 +75,5 @@ jobs: git config --local user.name "GitHub Action" git checkout -b staging git add banner.json - git commit -m "Updating banner for #${{ env.IssueNumber }}" + git commit -m "Updating banner for #${{ github.event.issue.number }}" git push