Skip to content

Commit

Permalink
Merge pull request #30135 from smoogipoo/diffcalc-workflow-state-at-c…
Browse files Browse the repository at this point in the history
…omment

Save `master` state when running diffcalc workflow
  • Loading branch information
bdach authored Oct 7, 2024
2 parents 9a8a5cd + 639caf1 commit 6596d30
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/diffcalc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ env:
EXECUTION_ID: execution-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}

jobs:
master-environment:
name: Save master environment
runs-on: ubuntu-latest
outputs:
HEAD: ${{ steps.get-head.outputs.HEAD }}
steps:
- name: Checkout osu
uses: actions/checkout@v4
with:
ref: master
sparse-checkout: |
README.md
- name: Get HEAD ref
id: get-head
run: |
ref=$(git log -1 --format='%H')
echo "HEAD=https://github.com/${{ github.repository }}/commit/${ref}" >> "${GITHUB_OUTPUT}"
check-permissions:
name: Check permissions
runs-on: ubuntu-latest
Expand All @@ -121,7 +140,7 @@ jobs:
create-comment:
name: Create PR comment
needs: check-permissions
needs: [ master-environment, check-permissions ]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request }}
steps:
Expand Down Expand Up @@ -158,7 +177,7 @@ jobs:
environment:
name: Setup environment
needs: directory
needs: [ master-environment, directory ]
runs-on: self-hosted
env:
VARS_JSON: ${{ toJSON(vars) }}
Expand All @@ -182,6 +201,10 @@ jobs:
fi
done
- name: Add master environment
run: |
sed -i "s;^OSU_A=.*$;OSU_A=${{ needs.master-environment.outputs.HEAD }};" "${{ needs.directory.outputs.GENERATOR_ENV }}"
- name: Add pull-request environment
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request }}
run: |
Expand Down

0 comments on commit 6596d30

Please sign in to comment.