Skip to content

Commit 2e72aa5

Browse files
authored
Merge pull request #1121 from mandiant/lsc-1771433323.1682847
Refactor Github Action per b/485167538
2 parents 2a55a30 + e91dc05 commit 2e72aa5

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# get all history and tags
2020
fetch-depth: 0
2121
- name: Get release text
22-
run: python .github/scripts/create_releases.py ${{ github.ref_name }} > release_body.txt
22+
run: python .github/scripts/create_releases.py ${GITHUB_REF_NAME} > release_body.txt
2323
- name: Create GitHub release
2424
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
2525
with:

.github/workflows/sync.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ jobs:
5959
pip install pyyaml
6060
- name: Add new rules to CHANGELOG
6161
run: |
62-
for added_file in ${{ steps.files.outputs.added }}; do
62+
for added_file in ${STEPS_FILES_OUTPUTS_ADDED}; do
6363
[[ $added_file != *.yml ]] && continue # Skip files that are not rules
6464
[[ $added_file == .git* ]] && continue # Skip git and GitHub Action files
6565
author=$(python rules/.github/scripts/changelog_author.py rules/$added_file)
6666
rule=$(echo $added_file | sed 's/\//\\\//g' | sed 's/\.yml//')
6767
sed -i "0,/- *$/s//- $rule $author\n-/" CHANGELOG.md
6868
done
69+
env:
70+
STEPS_FILES_OUTPUTS_ADDED: ${{ steps.files.outputs.added }}
6971
- name: Commit changes
7072
run: |
7173
git config user.email 'capa-dev@mandiant.com'

.github/workflows/tests.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,27 @@ jobs:
7979
if: github.event_name != 'workflow_dispatch' && github.event_name != 'schedule' && steps.lint_thorough.outcome != 'success'
8080
run: |
8181
cd rules/
82-
for changed_file in ${{ steps.files.outputs.added_modified }} ${{ steps.files.outputs.renamed }}; do
82+
for changed_file in ${STEPS_FILES_OUTPUTS_ADDED_MODIFIED} ${STEPS_FILES_OUTPUTS_RENAMED}; do
8383
if [[ ! $changed_file =~ .git|.md ]]; then
8484
tag=$(grep '\sname:' $changed_file | sed 's/^.*: //')
8585
python ../scripts/lint.py --thorough -t "$tag" -v .
8686
fi
8787
done
88+
env:
89+
STEPS_FILES_OUTPUTS_ADDED_MODIFIED: ${{ steps.files.outputs.added_modified }}
90+
STEPS_FILES_OUTPUTS_RENAMED: ${{ steps.files.outputs.renamed }}
8891
- name: Check feature overlaps on modified rules
8992
run: |
9093
cd rules/
91-
for changed_file in ${{ steps.files.outputs.added_modified }} ${{ steps.files.outputs.renamed }}; do
94+
for changed_file in ${STEPS_FILES_OUTPUTS_ADDED_MODIFIED} ${STEPS_FILES_OUTPUTS_RENAMED}; do
9295
if [[ ! $changed_file =~ (.git|.md) ]]; then
9396
python ../scripts/detect_duplicate_features.py . "$changed_file"
9497
fi
9598
done
9699
continue-on-error: true
100+
env:
101+
STEPS_FILES_OUTPUTS_ADDED_MODIFIED: ${{ steps.files.outputs.added_modified }}
102+
STEPS_FILES_OUTPUTS_RENAMED: ${{ steps.files.outputs.renamed }}
97103

98104
# On update of version branch, ensure that branch rules are compatible with latest respective release
99105
# assume we only update the branch that corresponds to the latest release
@@ -124,6 +130,6 @@ jobs:
124130
latest: true
125131
fileName: ${{ env.zip_name }}
126132
- name: Unzip
127-
run: unzip ${{ env.zip_name }} -d latest-release
133+
run: unzip ${ZIP_NAME} -d latest-release
128134
- name: Run latest release with current rules
129135
run: latest-release/capa -r rules/ tests/data/9324d1a8ae37a36ae560c37448c9705a.exe_

0 commit comments

Comments
 (0)