Skip to content

Commit 6d4e383

Browse files
authored
Fix hash-check workflow to check and merge against target branch of the PR (#21994)
* Fix hash-check workflow to check and merge against target branch of the PR * Fix files check as well * Explicity permissions withour write and remove the unnecessary merge * Simplify script using actions already in the repo
1 parent a2597dc commit 6d4e383

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

.github/workflows/release-hash-check.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,20 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
16-
contents: write
16+
contents: read
1717

1818
steps:
1919
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20-
with:
21-
fetch-depth: 0
2220

2321
- name: Set up Python
2422
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
2523
with:
2624
python-version: '3.13'
2725

28-
- id: files
29-
run: |
30-
git fetch origin master
31-
LAST_COMMON_COMMIT=$(git merge-base HEAD origin/master)
32-
FILES=$(git --no-pager diff --name-only $LAST_COMMON_COMMIT -- .in-toto | xargs echo)
33-
echo "all=$FILES" >> "$GITHUB_OUTPUT"
34-
35-
- id: merge
36-
name: Merge branch into latest master
37-
env:
38-
HEAD_BRANCH: ${{ github.head_ref }}
39-
run: |
40-
git fetch origin $HEAD_BRANCH
41-
git checkout origin/master
42-
git config user.name "release-hash-check"
43-
git config user.email "<>"
44-
git merge --no-commit --no-edit origin/$HEAD_BRANCH
26+
- name: Get changed files
27+
id: changed-files
28+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
29+
with:
30+
files: .in-toto/*.link
4531

46-
- run: python .github/workflows/release-hash-check.py ${{ steps.files.outputs.all }}
32+
- run: python .github/workflows/release-hash-check.py ${{ steps.changed-files.outputs.all_changed_files }}

0 commit comments

Comments
 (0)