From bda00c38a2df3b1e4ff237c994dc248fde03cca1 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 10 Oct 2024 16:37:41 -0400 Subject: [PATCH 1/2] Use $GITHUB_EVENT_PATH variable instead of inline file writing --- .github/workflows/event-processor.yml | 10 ++---- .../workflows/scheduled-event-processor.yml | 35 ++++--------------- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 907c0d5a6e9c..321dffc543b4 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -87,10 +87,7 @@ jobs: - name: Process Action Event run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH shell: bash env: # This is a temporary secret generated by github @@ -143,10 +140,7 @@ jobs: - name: Process Action Event run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH shell: bash env: # This is a temporary secret generated by github diff --git a/.github/workflows/scheduled-event-processor.yml b/.github/workflows/scheduled-event-processor.yml index 4b5f11322111..e7e625ba5562 100644 --- a/.github/workflows/scheduled-event-processor.yml +++ b/.github/workflows/scheduled-event-processor.yml @@ -69,10 +69,7 @@ jobs: - name: Close Stale Issues Scheduled Event if: github.event.schedule == '0 1 * * *' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json CloseStaleIssues + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH CloseStaleIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -80,10 +77,7 @@ jobs: - name: Identify Stale PullRequests Scheduled Event if: github.event.schedule == '0 5 * * FRI' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json IdentifyStalePullRequests + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH IdentifyStalePullRequests shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -91,10 +85,7 @@ jobs: - name: Close Stale PullRequests Scheduled Event if: github.event.schedule == '30 2,8,14,20 * * *' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json CloseStalePullRequests + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH CloseStalePullRequests shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -102,10 +93,7 @@ jobs: - name: Identify Stale Issues Scheduled Event if: github.event.schedule == '30 3,9,15,21 * * *' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json IdentifyStaleIssues + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH IdentifyStaleIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -113,10 +101,7 @@ jobs: - name: Close Addressed Issues Scheduled Event if: github.event.schedule == '30 4,10,16,22 * * *' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json CloseAddressedIssues + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -124,10 +109,7 @@ jobs: - name: Lock Closed Issues Scheduled Event if: github.event.schedule == '30 5,11,17,23 * * *' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json LockClosedIssues + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH LockClosedIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -135,10 +117,7 @@ jobs: - name: Enforce Max Life of Issues Scheduled Event if: github.event.schedule == '0 18 * * 1,3,5' run: | - cat > payload.json << 'EOF' - ${{ toJson(github.event) }} - EOF - github-event-processor ${{ github.event_name }} payload.json EnforceMaxLifeOfIssues + github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH EnforceMaxLifeOfIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9a495c19dfd8f1c3fbeeb3f87e3ef82f6ed44419 Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Thu, 10 Oct 2024 17:19:17 -0400 Subject: [PATCH 2/2] Archive github event data --- .github/workflows/event-processor.yml | 18 ++++++++++++++-- .../workflows/scheduled-event-processor.yml | 21 ++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/event-processor.yml b/.github/workflows/event-processor.yml index 321dffc543b4..32ec1923940d 100644 --- a/.github/workflows/event-processor.yml +++ b/.github/workflows/event-processor.yml @@ -87,7 +87,7 @@ jobs: - name: Process Action Event run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH + github-event-processor ${{ github.event_name }} ${{ github.event_path }} shell: bash env: # This is a temporary secret generated by github @@ -95,6 +95,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} LABEL_SERVICE_API_KEY: ${{ env.LABEL_SERVICE_API_KEY }} + - name: Archive github event data + uses: actions/upload-artifact@v4 + if: always() + with: + name: event + path: ${{ github.event_path }} + event-handler: permissions: issues: write @@ -140,9 +147,16 @@ jobs: - name: Process Action Event run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH + github-event-processor ${{ github.event_name }} ${{ github.event_path }} shell: bash env: # This is a temporary secret generated by github # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Archive github event data + uses: actions/upload-artifact@v4 + if: always() + with: + name: event + path: ${{ github.event_path }} diff --git a/.github/workflows/scheduled-event-processor.yml b/.github/workflows/scheduled-event-processor.yml index e7e625ba5562..fc57ee9ac31e 100644 --- a/.github/workflows/scheduled-event-processor.yml +++ b/.github/workflows/scheduled-event-processor.yml @@ -69,7 +69,7 @@ jobs: - name: Close Stale Issues Scheduled Event if: github.event.schedule == '0 1 * * *' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH CloseStaleIssues + github-event-processor ${{ github.event_name }} ${{ github.event_path }} CloseStaleIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -77,7 +77,7 @@ jobs: - name: Identify Stale PullRequests Scheduled Event if: github.event.schedule == '0 5 * * FRI' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH IdentifyStalePullRequests + github-event-processor ${{ github.event_name }} ${{ github.event_path }} IdentifyStalePullRequests shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -85,7 +85,7 @@ jobs: - name: Close Stale PullRequests Scheduled Event if: github.event.schedule == '30 2,8,14,20 * * *' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH CloseStalePullRequests + github-event-processor ${{ github.event_name }} ${{ github.event_path }} CloseStalePullRequests shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -93,7 +93,7 @@ jobs: - name: Identify Stale Issues Scheduled Event if: github.event.schedule == '30 3,9,15,21 * * *' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH IdentifyStaleIssues + github-event-processor ${{ github.event_name }} ${{ github.event_path }} IdentifyStaleIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -101,7 +101,7 @@ jobs: - name: Close Addressed Issues Scheduled Event if: github.event.schedule == '30 4,10,16,22 * * *' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH + github-event-processor ${{ github.event_name }} ${{ github.event_path }} shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -109,7 +109,7 @@ jobs: - name: Lock Closed Issues Scheduled Event if: github.event.schedule == '30 5,11,17,23 * * *' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH LockClosedIssues + github-event-processor ${{ github.event_name }} ${{ github.event_path }} LockClosedIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -117,7 +117,14 @@ jobs: - name: Enforce Max Life of Issues Scheduled Event if: github.event.schedule == '0 18 * * 1,3,5' run: | - github-event-processor ${{ github.event_name }} $GITHUB_EVENT_PATH EnforceMaxLifeOfIssues + github-event-processor ${{ github.event_name }} ${{ github.event_path }} EnforceMaxLifeOfIssues shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Archive github event data + uses: actions/upload-artifact@v4 + if: always() + with: + name: event + path: ${{ github.event_path }}