Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use mergify-cli #19

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 15 additions & 37 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
runs:
using: composite
steps:
- name: Setup Python 🔧
uses: actions/[email protected]
with:
python-version: 3.12.7

- name: Install dependencies
shell: bash
run: |
pip install mergify-cli

- shell: bash
id: gigid
env:
Expand All @@ -32,44 +42,12 @@
FILES: ${{ inputs.report_paths }}
REPOSITORY: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
WORKFLOW_JOB_NAME: ${{ inputs.name || github.job }}
JOB_NAME: ${{ inputs.name || github.job }}
CI_PROVIDER: github_action
run: |
set -x

# Check if FILES and MERGIFY_CI_ISSUES_TOKEN are set and not empty
if [ -z "$FILES" ]; then
echo "::error:: report_paths is not set or is empty"
exit 1
fi

if [ -z "$MERGIFY_CI_ISSUES_TOKEN" ]; then
echo "::error:: token is not set or is empty"
exit 1
fi

set +e

# TODO(sileht): support multiple files
curl -X POST \
--fail \
-v \
-H "Authorization: bearer ${MERGIFY_CI_ISSUES_TOKEN}" \
-F name=${WORKFLOW_JOB_NAME} \
-F provider=github_action \
-F head_sha=${HEAD_SHA} \
-F files=@${FILES} \
-o result.json \
${MERGIFY_API_SERVER}/repos/${REPOSITORY}/ci_issues_upload

if [ $? = 22 ]; then
echo "Upload failed"
test -f result.json && cat result.json
exit 22
fi

set -e

GIGID=$(jq -r .gigid result.json)
set -x -e

Check failure on line 49 in action.yml

View workflow job for this annotation

GitHub Actions / linters

49:1 [trailing-spaces] trailing spaces
GIGID=$(mergify ci-issues junit-upload ${FILES} | grep -oP 'gigid=\K[^)]+')

echo "::notice title=CI Issues report::CI_ISSUE_GIGID=$GIGID"
echo "CI_ISSUE_GIGID=$GIGID" >> "$GITHUB_OUTPUT"
Loading