Skip to content

Commit a31a674

Browse files
committed
ci: add check for files versions in PR
1 parent f7d6b24 commit a31a674

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.github/workflows/_check_pr.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Workflow use @main version ?
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
# This workflow will check if no files in `.github/workflows/` contains a line that start with `uses: shiipou/github-actions` and end with the branch from the PR.
11+
# If it does, it will mark a required check as failed and print all the files that contains the line.
12+
# It must ignore files in the list of ignored files.
13+
check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Check
18+
run: |
19+
branch=$(echo "${{ github.ref_name }}" | sed -e 's/refs\/heads\///g')
20+
ignore_rules=''
21+
if [ -n ${{ vars.ci_ignored_files }}" ];then
22+
ignore_rules=' | grep -vE "(${{ vars.ci_ignored_files }})"'
23+
fi
24+
files=$(grep -lE "uses: shiipou/github-actions/*@${branch}" .github/workflows/* ${ignore_rules}")
25+
if [ -n "$files" ]; then
26+
echo "The following files contains an action that uses the @${branch} version instead of @main:"
27+
echo "$files"
28+
exit 1
29+
fi

jobs/release/action.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ runs:
2929
using: "composite"
3030
steps:
3131
- name: Release
32+
shell: bash
3233
env:
3334
GITHUB_TOKEN: ${{ inputs.github-token }}
3435
run: |
@@ -39,4 +40,4 @@ runs:
3940
if ${{ inputs.pre-release }}; then
4041
ARGS="$ARGS --prerelease"
4142
fi
42-
gh release create $ARGS v${{ needs.sem-version.outputs.VERSION }} ${{ inputs.assets }}
43+
gh release create $ARGS v${{ inputs.version }} ${{ inputs.assets }}

0 commit comments

Comments
 (0)